parser_syslog: the regexp engine for RFC 5424 can match the header later in the message and corrupt the record
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 79/100
Hướng nghiên cứu
Bắt đầu với lib/fluent/plugin/parser_syslog.rb, tại lời gọi parse_plain đến Regexp#match(text, idx) được liên kết trong issue, rồi theo dõi cách các trường tiêu đề RFC 5424 được phân tích. Kiểm tra các bài kiểm thử parser cho RFC 5424 và các engine regexp và string. Hoàn thành khi engine regexp báo không khớp nếu các trường không khớp tại idx, mà không loại bỏ văn bản đứng trước hoặc làm hỏng bản ghi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
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.
https://github.com/fluent/fluentd/blob/e7d3c3e4/lib/fluent/plugin/parser_syslog.rb#L269
To Reproduce
Run the script below with bundle exec ruby -Ilib repro.rb in this repository.
Results on master (e7d3c3e4):
<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 lineis dropped.
require 'fluent/test'
require 'fluent/test/driver/parser'
require 'fluent/plugin/parser_syslog'
Fluent::Test.setup
%w[regexp string].each do |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",
].each do |text|
d.instance.parse(text) { |_time, record| puts "#{engine}: #{record.inspect}" }
end
end
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: -
Your Configuration
<parse>
@type syslog
message_format rfc5424
with_priority true
</parse>
Your Error Log
No error or warning is logged.
Additional context
parse_rfc3164_regex also uses the same parse_plain. I did not check whether RFC 3164 messages are affected.
- Ngôn ngữ chính
- Ruby
- Star
- 13.6k
- Fork
- 1.4k
- Merge trung bình
- 17 giờ 28 phút
- Pull request đã merge (30 ngày)
- 66
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của fluent/fluentd
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
parser_syslog: message_format auto parses RFC 3164 messages with an RFC 3339 timestamp as RFC 5424Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
out_forward: unacknowledged chunks are resent forever with heartbeat_type none, ignoring retry limits and secondaryCó thể đã có người làm @SahinurDEV đã nhận 1 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 74/100
fluent/fluentd#5619 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A label looked up at runtime during a graceful reload can keep dropping the events of a tagCó thể đã có người làm @sarankumar1325 đã nhận hôm nay. Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của fluent/fluentd
Issue tương tự
-
Websockify heartbeat for vnc_containerCó thể đã có người làm @robinkar đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Mend: dependency security vulnerability
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
metanorma/metanorma-cli#494 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug: a killed mutant is scored errored when the failing test's message contains binary bytesĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
davidteren/mutineer#434 ·
Maintainer thường phản hồi trong vòng 2 ngày