[8.x](backport #41244) Read journal entries from all boots #41403
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed commit message
Some versions of journalctl will only return messages from the current boot when --follow is passed, it will even ignore the cursor or date arguments.
This commit reads messages from all boots by first calling journalctl without the --follow flag, reading all entries and once it successfully exits, then we restart journalctl with the cursor and the --follow flag.
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.## Disruptive User ImpactAuthor's Checklist
TestInputParsers
fromfilebeat/input/journald/input_parsers_test.go
is not flakyHow to test this PR locally
1. Run the tests
2. Run Filebeat reading
filebeat/input/journald/testdata/multiple-boots.journal
There must be 6 entries, you can see the plaintext entries by looking at
filebeat/input/journald/testdata/multiple-boots.export
or by running:3. Fully manual test
Related issues
## Use cases## Screenshots## LogsThis is an automatic backport of pull request #41244 done by Mergify.