I use promtail to push my docker-compose’s log,but I meet a problem like this:
level=error ts=2023-05-11T01:38:37.421215001Z caller=client.go:430 component=client host=loki:3100 msg="final error sending batch" status=400 tenant= error="server returned HTTP status 400 Bad Request (400): error at least one label pair is required per stream"
It seems like my promtail configured Incorrectly.This is my config:
I’m having a similar problem myself though I am getting the logs for promtail it is also sending logs like this
2023-11-02 20:42:09.555 trajano_promtail.ic4p6gb3jq91xmqv7cpyep8ij.qsmyx1it80x5lnnjmymouxdb4 stderr
level=error ts=2023-11-03T00:42:09.473271419Z caller=client.go:430 component=client host=loki:3100 msg=“final error sending batch” status=400 tenant= error=“server returned HTTP status 400 Bad Request (400): error at least one label pair is required per stream”
So I am getting the replacement but some messages are causing a problem. So I tried to do the drop when __meta_docker_container_name is '' along with a label check
Turning on debug log didn’t help much since it didn’t tell me what message or log entry it sent that causes the issue.
level=error ts=2024-01-29T14:31:18.460915591Z caller=manager.go:49 component=distributor path=write insight=true msg="write operation failed" details="error at least one label pair is required per stream"
It does not happen when I remove this bit:
- source_labels: ['__meta_docker_container_label_grafana_logging_disable']
regex: 'true'
action: drop
Have you found a solution for this?
Does anybody know whether there any way to drop logs only if a label has a certain value?
Static labels work well for static (well, obviously) labels that would be great to add. For example, in my current configuration I add hostname so that in grafana I can filter by this label: