Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't bail out from systemd log reader when reaching the end #90

Closed
wants to merge 1 commit into from

Conversation

Ma27
Copy link

@Ma27 Ma27 commented May 26, 2022

The log search starts at the current time, i.e. the end of the journal
(SeekTail() / SeekRealtimeUsec) and thus runs into an EOF.

Not a big deal because the code takes care of that, but the log-reading
loop is exited then and further messages are ignored.

Potentially fixes #55.

The log search starts at the current time, i.e. the end of the journal
(`SeekTail()` / `SeekRealtimeUsec`) and thus runs into an EOF.

Not a big deal because the code takes care of that, but the log-reading
loop is exited then and further messages are ignored.
@elsgaard
Copy link

The log search starts at the current time, i.e. the end of the journal (SeekTail() / SeekRealtimeUsec) and thus runs into an EOF.

Not a big deal because the code takes care of that, but the log-reading loop is exited then and further messages are ignored.

Potentially fixes #55.

I made a build with the PR, and deployed the exporter to a couple of our production servers (RHEL 8), but they went to 100% CPU until i stopped the exporters again 15 min later. Has anybody else seen this ?

@ktosiek
Copy link

ktosiek commented Sep 12, 2022

I don't think this is the right fix: log sources should wait for new data, and handle basic problems inside Read (at least that's what FileLogSource is doing by using a tailer).

sd_journal_next doesn't wait for new data, the fix is to .Wait() if sd_journal_next returns 0. See the example in sd_journal_wait man page: https://manpages.debian.org/testing/libsystemd-dev/sd_journal_wait.3.en.html#EXAMPLES

@Rudd-O
Copy link

Rudd-O commented Nov 18, 2022

We need this fix too, and sadly the CPU spinning problem is a blocker for us.

@Ma27
Copy link
Author

Ma27 commented Nov 27, 2022

Yeah I only tested it on a mailserver which doesn't have too much traffic (and relatively few logs).

However I think that it's perhaps better to just use loki for that purpose (and define alerts in Grafana), at least that's what I'm planning to do these days. Since I'm not planning to find a better solution, I'll close this now, sorry.

@Ma27 Ma27 closed this Nov 27, 2022
@Ma27 Ma27 deleted the no-log-bailout branch November 27, 2022 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

journald metrics not available
4 participants