You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
parser_syslog: the regexp engine for RFC 5424 can match the header later in the message and corrupt the record #5630
With message_format rfc5424 and the default parser_engine regexp, the parser matches the header fields after the timestamp with re.match(text, idx). Regexp#match with a position does not anchor the match at that position. When the text at idx does not match, the regexp can match later in the text. The record then gets values from the wrong place, and the text before the match is dropped. No warning is logged.
<14>1 2026-04-25T16:43:29Z hôst app 123 ID - msg: the regexp engine returns "host" => "st". The string engine returns "host" => "hôst".
<14>1 2026-04-25T16:43:29Z first line\nhost app 123 ID - second line: the regexp engine returns "host" => "host" and "message" => "second line". first line is dropped.
require'fluent/test'require'fluent/test/driver/parser'require'fluent/plugin/parser_syslog'Fluent::Test.setup%w[regexpstring].eachdo |engine|
d=Fluent::Test::Driver::Parser.new(Fluent::Plugin::SyslogParser).configure(%[ message_format rfc5424 with_priority true parser_engine #{engine} ])['<14>1 2026-04-25T16:43:29Z hôst app 123 ID - msg',"<14>1 2026-04-25T16:43:29Z first line\nhost app 123 ID - second line",].eachdo |text|
d.instance.parse(text){ |_time,record| puts"#{engine}: #{record.inspect}"}endend
Expected behavior
The regexp engine does not skip text. If the header fields do not match at that position, the message is reported as not matched. Anchoring the match at idx (for example with \G) would do this.
Your Environment
- Fluentd version: master (e7d3c3e4). v1.20.1 and v1.19.4 have the same code (not run).
- Package version: -
- Operating system: Linux
- Kernel version: -
I also reproduced this on v1.19.4 with the same script. The results are the same as on master. The current re.match(text, idx) form has been there since v1.10.0 (09f5d11).
Activity
Watson1978 commentedon Nov 11, 2026
I also reproduced this on v1.19.4 with the same script. The results are the same as on master. The current
re.match(text, idx)form has been there since v1.10.0 (09f5d11).rafayqayyum commentedon Nov 15, 2026
Opened #5641 for this, anchoring the regexp with
\Gas you suggested; both inputs from the issue are now reported as not matched.