[9.5](backport #52231) Fix journald input on journalctl older than 245 with facility filters#52253
Open
mergify[bot] wants to merge 1 commit into
Open
[9.5](backport #52231) Fix journald input on journalctl older than 245 with facility filters#52253mergify[bot] wants to merge 1 commit into
mergify[bot] wants to merge 1 commit into
Conversation
…#52231) journalctl only supports the --facility flag since systemd v245, but the journald input passed it unconditionally whenever facilities was configured. On older systems (e.g. RHEL 8, which ships systemd 239) journalctl exits immediately with unrecognized option '--facility' and the input restarts it in an endless backoff loop, silently collecting no events. The System integration configures facility filters on both of its journald streams, so those streams collect nothing on RHEL 8. Instead of gating the flag on the journalctl version, facilities are now always passed as SYSLOG_FACILITY=N journal field matches. Every journalctl version supports field matches, and --facility is implemented internally as exactly these matches: matches on the same field are ORed together, the same semantics as repeated --facility flags. Because journalctl does not range-check field matches the way it range-checks --facility, the input's config now validates that each facility is within 0-127 (the range --facility accepts), so an out-of-range value fails at config time instead of silently matching nothing. While moving config validation around, the deprecation warning for the legacy 7.x include_matches array format was also moved out of Unpack (which had to use a package-global logger) into Configure, where the input's logger is available. (cherry picked from commit 8a654fc)
mergify
Bot
requested review from
AndersonQ and
belimawr
and removed request for
a team
July 24, 2026 19:57
Contributor
🤖 GitHub commentsJust comment with:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
journalctl only supports the
--facilityflag since systemd v245, but the journald input passed it unconditionally wheneverfacilitieswas configured. On older systems (e.g. RHEL 8, which ships systemd 239) journalctl exits immediately withunrecognized option '--facility'and the input restarts it in an endless backoff loop, silently collecting no events. The System integration configures facility filters on both of its journald streams, so those streams collect nothing on RHEL 8.Instead of gating the flag on the journalctl version, facilities are now always passed as
SYSLOG_FACILITY=Njournal field matches. Every journalctl version supports field matches, and--facilityis implemented internally as exactly these matches: matches on the same field are ORed together, the same semantics as repeated--facilityflags. Because journalctl does not range-check field matches the way it range-checks--facility, the input's config now validates that each facility is within 0-127 (the range--facilityaccepts), so an out-of-range value fails at config time instead of silently matching nothing.While moving config validation around, the deprecation warning for the legacy 7.x
include_matchesarray format was also moved out ofUnpack(which had to use a package-global logger) intoConfigure, where the input's logger is available.Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesstresstest.shscript to run them under stress conditions and race detector to verify their stability../changelog/fragmentsusing the changelog tool.Disruptive User Impact
On journalctl >= 245 the selected events are unchanged (only the journalctl command line differs). On older versions, configurations with
facilitiesset go from collecting nothing (journalctl crash loop) to collecting the requested events. Configurations with a facility outside 0-127 now fail config validation; previously such values made journalctl (>= 245) exit with an error at runtime.How to test this PR locally
On a host/container with systemd < 245 (e.g. RHEL 8 / ubi8), run Filebeat with:
Without this patch journalctl exits with code 1 (
unrecognized option '--facility') in a restart loop and no events are ingested. With the patch, Filebeat invokes journalctl withSYSLOG_FACILITY=4 SYSLOG_FACILITY=10matches (on every journalctl version) and ingests events.Unit tests:
go test ./filebeat/input/journald/...Related issues
v242#48152 (--boot allon journalctl < 242)This is an automatic backport of pull request #52231 done by [Mergify](https://mergify.com).