parser_syslog: string parser ends RFC5424 structured data at an escaped "]"
メンテナーはふだん 1 日以内に返信
関連するプルリクエストがすでにマージされています。
- #5591 @yuminn-k による — マージ済み
評価
調査の方向性
parse_rfc5424から始めてください。issueによると、text.index('] ', cursor)が構造化データの境界を見つけます。提供されたRFC5424入力を使って、文字列パーサーと正規表現パーサーを比較してください。既存のパーサーテストを追い、エスケープされた]の後に空白が続くケースの回帰テストを追加してください。extradataに構造化データ全体が含まれ、messageがmsgになれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
With parser_engine string, parser_syslog ends STRUCTURED-DATA at the first ] in the message. It does not check whether the ] is escaped. When a PARAM-VALUE contains \] followed by a space, the rest of the structured data goes into message.
RFC 5424 section 6.3.3 requires ] in a PARAM-VALUE to be escaped as \], so this is a valid message.
Input:
<14>1 2026-04-25T16:43:29.123Z host app 123 ID [x@1 a="b\] c"] msg
extradata |
message |
|
|---|---|---|
parser_engine string |
[x@1 a="b] |
c"] msg |
parser_engine regexp |
[x@1 a="b\] c"] |
msg |
To Reproduce
-
Create
/tmp/syslog.logwith this line:<14>1 2026-04-25T16:43:29.123Z host app 123 ID [x@1 a="b\] c"] msg -
Run Fluentd with the configuration below.
Expected behavior
extradata contains the whole structured data and message is msg, as with parser_engine regexp.
Actual output:
test: {"host":"host","ident":"app","pid":"123","msgid":"ID","pri":14,"extradata":"[x@1 a=\"b]","message":"c\"] msg"}
Your Environment
- Fluentd version: 1.20.1 (master at f55db4b1)
- Package version: N/A (from source)
- Operating system: CachyOS
- Kernel version: 7.3.1-1-cachyos
- Ruby: 4.0.9
Your Configuration
<source>
@type tail
path /tmp/syslog.log
pos_file /tmp/syslog.log.pos
read_from_head true
tag test
<parse>
@type syslog
message_format rfc5424
with_priority true
parser_engine string
</parse>
</source>
<match test>
@type stdout
</match>
Your Error Log
No error is logged. The record is emitted with wrong fields.
Additional context
parse_rfc5424 finds the end of the structured data with text.index('] ', cursor). This exists since v1.11.0.
- 主要言語
- Ruby
- スター
- 13.6k
- フォーク
- 1.4k
- 平均マージ
- 1日 1時間
- マージ済み PR(30日)
- 61
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
fluent/fluentd のほかの issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
in_tcp, in_syslog: a non-ASCII delimiter closes the connection with Encoding::CompatibilityErrorオープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
メンテナーはふだん 1 日以内に返信
-
bug enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
fluent/fluentd#5494 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
BufferChunkOverflowError inside @ERROR loops forever - no buffer parameter can stop it再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンbug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
fluent/fluentd#5462 · コメント 8 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
Malformed encoded_filters causes a 500, and keeps failing with session persistence対応中かも @officialasishkumar が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
Visual COBOL: missing 11.0 and 12.0, and 9.0 date differs from Rocket Software's lifecycle pageオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
endoflife-date/endoflife.date#11561 ·
メンテナーはふだん 1 日以内に返信