Open suever opened 1 month ago
I think you're right.. and what can we do for this problem?
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!
What's wrong?
According to the documentation for the
loki.source.journal
component, if nopath
is specified for theloki.source.journal
component, then/var/log/journal
is used by default .When using the very basic configuration from the example:
When running alloy with the
loki.source.journal
component configured as above on a host directly, logs are discovered and scraped properly; however, when running within a container on the host and mounting/var/log/journal
as a volume into the container, the logs are not discovered.After digging into the code, this is due to the fact that, when no
path
is specified, alloy takes a different code path which usesgo-systemd
's defaults for discovering the journal entries which uses theSD_JOURNAL_LOCAL_ONLY
option which ensures that only logs generated on the local machine are discovered. If you explicitly specify apath
configuration option to theloki.source.journal
component, then journal entries are discovered a different way which does not specify theSD_JOURNAL_LOCAL_ONLY
option, which does not limit it to local logs only and it is able to discover the logs from the host/var/log/journal
.I'm not sure if this is a documentation issue for the component where it should state that you must set
path = "/var/log/journal"
when running in Docker, or probably more appropriately a code change where the default path is specified explicitly in alloy codebase and thengo-systemd/sdjournal
is invoked the same way regardless of whether a path was supplied or not which removes the behavior of alloy being dependent upon go-systemd's implementation.I am happy to contribute a fix, but wanted to let the maintainers determine what is most appropriate to avoid confusion for users like this one
Steps to reproduce
Create the following config in
config.alloy
Run it locally on a linux machine
Ensure journal targets are discovered:
Run it in docker:
Ensure no journal targets are discovered
Modify the config to explicitly set the
path
Re-run in docker, and ensure that targets are now discovered
System information
Linux / Docker
Software version
v1.1.0 and master
Configuration
Logs
No response