Skip to content

parser_syslog: fix NameError when RFC5424 timestamp has repeated spaces - #5496

Merged
kenhys merged 1 commit into
fluent:masterfrom
Watson1978:parser-syslog-rfc5424-space-count
Sep 15, 2026
Merged

kenhys merged 1 commit into
fluent:masterfrom
Watson1978:parser-syslog-rfc5424-space-count

Conversation

@Watson1978

Copy link
Copy Markdown
Contributor

Which issue(s) this PR fixes:
Fixes #

What this PR does / why we need it:

The RFC5424 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, for example the RFC3164 style %b %d %H:%M:%S with 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

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
kenhys merged commit 5385b6f into fluent:master Sep 15, 2026
20 checks passed
@Watson1978
Watson1978 deleted the parser-syslog-rfc5424-space-count branch September 15, 2026 02:33
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport to v1.19 We will backport this fix to the LTS branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants