Commit 044dd81
parser_syslog: accept a space after RFC3164 priority (#5449)
<!--
Thank you for contributing to Fluentd!
Your commits need to follow DCO: https://probot.github.io/apps/dco/
And please provide the following information to help us make the most of
your pull request:
-->
**Which issue(s) this PR fixes**:
Fixes #4158
**What this PR does / why we need it**:
Some syslog senders emit RFC3164 records with an ASCII space between the
priority and header. Depending on whether `in_syslog` or the parser owns
priority extraction, the RFC3164 parser sees that space either
immediately after `>` or as the first character of its input, and
currently attempts to parse it as the start of the timestamp.
This change accepts the RFC3164 boundary space in `rfc3164` and the
RFC3164 path of `auto`, across both parser engines and both
priority-ownership models. Canonical records without the space continue
to parse unchanged, malformed priorities remain invalid, and RFC5424
parsing is unchanged.
For the default RFC3164 time format, regression coverage verifies that
two boundary spaces and tabs remain invalid. An explicit RFC3164
`time_format` beginning with a space treats that leading space as
timestamp syntax, so this change does not impose or claim a one-space
maximum for that configuration.
This also corrects the string parser's dynamic timestamp slice cursor
and the field-count accounting needed by RFC3164 time formats that begin
with a space. Truncated subsecond records with the boundary space are
rejected through the normal `[nil, nil]` path instead of raising while
looking for the missing field delimiter.
**Docs Changes**:
None. This broadens input compatibility without adding or changing
configuration.
**Release Note**:
parser_syslog: accept one optional ASCII space between RFC3164 priority
and header.
**Testing**:
- `bundle exec ruby -Itest test/plugin/test_parser_syslog.rb --name
test_truncated_subsecond_rfc3164_is_rejected_without_raising` — 4 tests,
12 assertions, 0 failures, 0 errors across `rfc3164`/`auto` and
parser-owned/input-owned priority
- `bundle exec ruby -Itest test/plugin/test_parser_syslog.rb` — 132
tests, 521 assertions, 0 failures, 0 errors
- `bundle exec ruby -Itest test/plugin/test_in_syslog.rb` — 41 tests,
280 assertions, 0 failures, 0 errors
- `bundle exec rake test` — 4,401 tests, 16,154 assertions, 0 failures,
0 errors, 3 pendings, 36 omissions
- `gem exec rubocop` — 460 files inspected, 0 offenses
- Balanced microbenchmark with 8 samples per revision and case — all 8
prespecified fixed regression gates passed. The narrowest throughput
ratio was 0.953; this was used only as a regression gate, and no
performance improvement is claimed.
- Installed-gem UDP validation — 20/20 scenarios passed. Both baseline
and candidate gems were built and installed into isolated environments,
real `fluentd --no-supervisor` processes were started, and packets were
sent by external UDP clients. The original 16-scenario matrix covered
both parser engines, both priority-ownership models, `rfc3164`/`auto`,
canonical and spaced packets, whitespace rejection, RFC5424
compatibility, and explicit leading-space time formats. Four additional
string-parser scenarios verified that the truncated subsecond packet
takes the normal unmatched path without an exception and that a valid
`.5` sibling is parsed by the same live process across `rfc3164`/`auto`
and both priority-ownership modes.
---------
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Co-authored-by: Shizuo Fujita <fujita@clear-code.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 2e91eb6 commit 044dd81
3 files changed
Lines changed: 436 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| |||
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
| 127 | + | |
126 | 128 | | |
127 | 129 | | |
128 | 130 | | |
129 | 131 | | |
| 132 | + | |
130 | 133 | | |
131 | 134 | | |
132 | 135 | | |
| |||
162 | 165 | | |
163 | 166 | | |
164 | 167 | | |
| 168 | + | |
| 169 | + | |
165 | 170 | | |
166 | 171 | | |
167 | 172 | | |
| |||
180 | 185 | | |
181 | 186 | | |
182 | 187 | | |
| 188 | + | |
183 | 189 | | |
184 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
185 | 198 | | |
186 | 199 | | |
187 | 200 | | |
188 | 201 | | |
| 202 | + | |
189 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
190 | 208 | | |
191 | 209 | | |
192 | 210 | | |
| |||
287 | 305 | | |
288 | 306 | | |
289 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
290 | 316 | | |
291 | 317 | | |
292 | 318 | | |
293 | | - | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
294 | 322 | | |
295 | 323 | | |
296 | 324 | | |
297 | | - | |
| 325 | + | |
298 | 326 | | |
299 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
300 | 332 | | |
301 | 333 | | |
302 | 334 | | |
| |||
312 | 344 | | |
313 | 345 | | |
314 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
315 | 351 | | |
316 | 352 | | |
317 | | - | |
| 353 | + | |
318 | 354 | | |
319 | 355 | | |
320 | 356 | | |
321 | 357 | | |
322 | | - | |
| 358 | + | |
323 | 359 | | |
324 | 360 | | |
325 | 361 | | |
| |||
363 | 399 | | |
364 | 400 | | |
365 | 401 | | |
366 | | - | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
367 | 408 | | |
368 | 409 | | |
369 | 410 | | |
370 | 411 | | |
371 | 412 | | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
372 | 419 | | |
373 | 420 | | |
374 | 421 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
127 | 200 | | |
128 | 201 | | |
129 | 202 | | |
| |||
0 commit comments