Open palbiez opened 2 days ago
I made a several test for the subfolder log.
Created a new directory named alloy in /var/log/
Made chmod 766
Stderr of alloy.service to /var/log/alloy_err.log
Restarted alloy service
In my perspective the local.file_match "local_subfolder_log"
should find this new files at startup or all 5 seconds
But it won’t be found Still the service found only Apache and apt logs in subfolders
What's wrong?
Hi all, I’m totally confused at the moment.
I setted up alloy, loki and on another host grafana and want to tail my logs and show them in Grafana.
First I set up the loki config
alloy config see above
After this a few of my logfiles will be shown in Grafana Explore and also in Alloy Metrics
But for example my router logs, which will be sent to /var/log/$HOST/yyyy_mm_dd.log won’t be found. In the Debug log I found the following entry
But the logs are definitly present on host and readable. For Example
I have already rebooted, checked several configs and so on but the logs won’t be shown in Grafana / metrics
Steps to reproduce
see above. I already deleted the positions.yml at /var/lib/alloy, removed tail_from_end = true and changed the targets to path_targets = [{"path" = "/var/log/router/**"}] But nothing happenes
System information
Linux 6.8.4-2-pve #1 SMP PMX 6.8.4-2 x86_64 GNU/Linux
Software version
Gafana Alloy v1.4.1
Configuration
logging { level = "debug" format = "logfmt" }
livedebugging { enabled = true }
loki.source.syslog "local" { listener { address = "127.0.0.1:1514" labels = { component = "loki.source.syslog", protocol = "tcp" } }
listener { address = "127.0.0.1:1514" protocol = "udp" labels = { component = "loki.source.syslog", protocol = "udp"} }
forward_to = [loki.write.grafana_loki.receiver] }
prometheus.exporter.unix "default" { include_exporter_metrics = true disable_collectors = ["mdadm"] }
prometheus.scrape "default" { targets = array.concat( prometheus.exporter.unix.default.targets, [{ // Self-collect metrics job = "alloy", address = "127.0.0.1:12345", }], )
forward_to = [ // TODO: components to forward metrics to (like prometheus.remote_write or // prometheus.relabel). ] }
local.file_match "local_files" { path_targets = [{"path" = "/var/log/*.log"}] sync_period = "5s" }
local.file_match "local_syslog" { path_targets = [{"path" = "/var/log/syslog"}] sync_period = "5s" }
local.file_match "local_subfolder_log" { path_targets = [{"path" = "/var/log/*/.log"}] sync_period = "5s" }
local.file_match "local_router_log" { path_targets = [{"path" = "/var/log/router/*/.log"}] sync_period = "5s" }
loki.source.file "log_scrape" { targets = local.file_match.local_files.targets forward_to = [loki.write.grafana_loki.receiver] tail_from_end = true }
loki.source.file "syslog_scrape" { targets = local.file_match.local_syslog.targets forward_to = [loki.write.grafana_loki.receiver] tail_from_end = true }
loki.source.file "subfolder_log_scrape" { targets = local.file_match.local_subfolder_log.targets forward_to = [loki.write.grafana_loki.receiver] tail_from_end = true }
loki.source.file "router_log_scrape" { targets = local.file_match.local_router_log.targets forward_to = [loki.write.grafana_loki.receiver] tail_from_end = true }
loki.write "grafana_loki" { endpoint { url = "http://localhost:3100/loki/api/v1/push" } }
Logs