Skip to content

loki.source.docker corrupts logs split by docker #4625

@axd1x8a

Description

@axd1x8a

Component(s)

loki.source.docker

What's wrong?

Here is an example of this:

{
    "a": 1033461950,
    "b": true
},
2025-10-17T22: 40: 09.574025386Z {
    "a": 1033471950,
    "b": true
},
{
    "a": 1034411950,
    "b": true
},

Steps to reproduce

1.Set up docker JSON logging with alloy and loki.
2.Log something that exceeds the docker line limit and will be split.

System information

No response

Software version

Grafana Alloy v1.11.2

Configuration

discovery.docker "container_logs" {
	host             = "unix:///var/run/docker.sock"
	refresh_interval = "10s"

	filter {
		name   = "label"
		values = ["logging=alloy"]
	}
}

discovery.relabel "container_logs" {
	targets = discovery.docker.container_logs.targets

	rule {
		source_labels = ["__meta_docker_container_id"]
		target_label  = "container_id"
	}
}

loki.source.docker "container_logs" {
	host       = "unix:///var/run/docker.sock"
	targets    = discovery.relabel.container_logs.output
	forward_to = [loki.process.container_logs.receiver]
	refresh_interval = "10s"
}

loki.process "container_logs" {
	forward_to = [loki.write.default.receiver]
}

loki.write "default" {
	endpoint {
		url = "http://loki:3100/loki/api/v1/push"
	}
	external_labels = {}
}

Logs


Tip

React with 👍 if this issue is important to you.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions