parser_syslog: fix NameError when RFC5424 timestamp has repeated spaces - #5496
Merged
kenhys merged 1 commit intoSep 15, 2026
Merged
Conversation
The string parser's RFC5424 path slices the timestamp with an `idx` variable that only exists in the regexp parser, so any input taking the repeated-space branch raised NameError instead of being parsed. This branch is reachable whenever `time_format` contains a space, for example the RFC3164-style `%b %d %H:%M:%S` with a space-padded day. Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
kenhys
approved these changes
Sep 15, 2026
kenhys
pushed a commit
that referenced
this pull request
Sep 15, 2026
…has repeated spaces (#5449) (#5497) **Which issue(s) this PR fixes**: Partial backport of #5449 Related to #5496 Fixes # **What this PR does / why we need it**: The RFC3164 string parser slices the timestamp with an `idx` variable that only exists in the regexp parser, so any message taking the repeated-space branch raised `NameError` instead of being parsed. That branch is reached whenever `time_format` contains a space and the timestamp is space-padded, for example `%Y-%m-%d %H:%M:%S` against `<14>2026-04-25 16:43:29 host app: msg`. This backports only the `NameError` fix. The rest of #5449 makes the parser accept a space after the priority, which changes behavior, so it is left out. **Docs Changes**: N/A **Release Note**: * parser_syslog: fix NameError when RFC3164 timestamp has repeated spaces Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
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.
Which issue(s) this PR fixes:
Fixes #
What this PR does / why we need it:
The RFC5424 string parser slices the timestamp with an
idxvariable that only exists in the regexp parser, so any message taking the repeated-space branch raisedNameErrorinstead of being parsed. That branch is reached whenevertime_formatcontains a space, for example the RFC3164 style%b %d %H:%M:%Swith a space-padded day. #5449 fixed the same mistake on the RFC3164 side, and this PR does the rest.Docs Changes:
N/A
Release Note:
parser_syslog: fix NameError when RFC5424 timestamp has repeated spaces