I want to scrape the host journald log with Alloy running in a docker container. But nothing is read or sent.
Here is the config.alloy
loki.relabel "journal" {
forward_to = []
rule {
source_labels = ["__journal__systemd_unit"]
target_label = "systemd_unit"
}
rule {
source_labels = ["__journal__hostname"]
target_label = "systemd_hostname"
}
rule {
source_labels = ["__journal__transport"]
target_label = "systemd_transport"
}
}
loki.source.journal "read" {
forward_to = [loki.write.grafanacloud.receiver]
relabel_rules = loki.relabel.journal.rules
max_age = "12h"
labels = {component = "loki.source.journal"}
}
loki.write "grafanacloud" {
endpoint {
url = "https://logs-prod-007.grafana.net/loki/api/v1/push"
basic_auth {
username = "*****"
password = "glc_*****"
}
}
}
And the command to start the Alloy container:
sudo docker run -d --restart=unless-stopped --name=grafana-alloy \
-v /etc/alloy:/etc/alloy \
-v /run/log:/run/log \
-v /var/log:/var/log \
grafana/alloy:latest \
run --storage.path=/var/lib/alloy/data /etc/alloy/config.alloy
I use the same Alloy configuration on another system with Alloy installed by apt
, and it works without issue.
The debug panel shows green for all components. I also exec
into the Alloy container and checked that the logs in /var/log
and /run/log
are readable.
What could be the problem?