Open palbiez opened 1 month 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
Community post: https://community.grafana.com/t/alloy-dont-find-targets-of-logfiles/133495/5
I was unable to reproduce.
This issue has not had any activity in the past 30 days, so the needs-attention
label has been added to it.
If the opened issue is a bug, check to see if a newer release fixed your issue. If it is no longer relevant, please feel free to close this issue.
The needs-attention
label signals to maintainers that something has fallen through the cracks. No action is needed by you; your issue will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity.
Thank you for your contributions!
This is happening for me as well. Debug shows nothing helpful. Have tried:
Minimal config:
logging {
level = "debug"
format = "logfmt"
}
local.file_match "local_subfolder_log" {
path_targets = [
{__path__ = "/var/log/*.log"},
{__path__ = "/var/log/*/*.log"},
{__path__ = "/var/log/*/*/*.log"},
]
sync_period = "5s"
}
loki.source.file "subfolder_log_scrape" {
targets = local.file_match.local_subfolder_log.targets
forward_to = [loki.write.grafana_loki.receiver]
}
loki.write "grafana_loki" {
external_labels = {
app = "loki_test",
}
endpoint {
url = "http://10.2.2.10:3100/loki/api/v1/push"
}
}
Directory /var/log has ACL in place for alloy to read log files.
Also removed positions.yml
This has to be a bug.
I had the same problem, I was able to access the logs file by running the alloy.service
from the root
user instead of the alloy
user.
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