in_syslog: PRI values above 191 are accepted and the tag gets an empty facility

オープン 初心者向け
#5,632 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
ruby
領域
backend

調査の方向性

lib/fluent/plugin/in_syslog.rb の issue で参照されている PRI からタグへのマッピングから始め、デフォルト設定の場合と with_priority false の場合の両方で PRI がどのように解析されるかを追ってください。無効な syslog メッセージに関する既存のテストを確認し、両方のモードで 191 を超える PRI 値のテストを追加してください。無効な PRI 値について警告が出て出力されず、有効な PRI 191 は引き続き機能することを完了条件とします。

索引モデルが issue の本文から書いたものです。

説明

Describe the bug

in_syslog builds the tag from FACILITY_MAP[pri >> 3] and SEVERITY_MAP[pri & 0b111]. It does not check that PRI is in the valid range 0 to 191. For a larger PRI, the facility is nil, and the tag gets an empty part.

https://github.com/fluent/fluentd/blob/e7d3c3e4/lib/fluent/plugin/in_syslog.rb#L325

  • With the default parse settings (with_priority true), <200> is emitted with the tag syslog..emerg. (<1234> is rejected, because the parser reads at most 3 digits.)
  • With with_priority false, in_syslog reads PRI with SYSLOG_REGEXP ([0-9]+). <200> gives syslog..emerg, and <1234> gives syslog..crit.
To Reproduce

Run Fluentd with the configuration below. Then send these messages:

ruby -rsocket -e 'u = UDPSocket.new; ["<200>Apr 25 16:43:29 host app: msg", "<1234>Apr 25 16:43:29 host app: msg", "<191>Apr 25 16:43:29 host app: msg"].each { |m| u.send(m, 0, "127.0.0.1", 5140) }'

Output on master (e7d3c3e4) with the default parse settings:

2026-04-25 16:43:29.000000000 +0900 syslog..emerg: {"host":"host","ident":"app","message":"msg"}
[warn]: failed to parse message data="<1234>Apr 25 16:43:29 host app: msg"
2026-04-25 16:43:29.000000000 +0900 syslog.local7.debug: {"host":"host","ident":"app","message":"msg"}

Output with with_priority false in <parse>:

2026-04-25 16:43:29.000000000 +0900 syslog..emerg: {"host":"host","ident":"app","message":"msg"}
2026-04-25 16:43:29.000000000 +0900 syslog..crit: {"host":"host","ident":"app","message":"msg"}
2026-04-25 16:43:29.000000000 +0900 syslog.local7.debug: {"host":"host","ident":"app","message":"msg"}
Expected behavior

A PRI outside 0 to 191 is treated as invalid, as RFC 5424 defines this range. in_syslog warns and does not emit it with a broken tag, like other invalid messages.

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
<source>
  @type syslog
  port 5140
  bind 127.0.0.1
  tag syslog
  # For the second case:
  # <parse>
  #   @type syslog
  #   with_priority false
  # </parse>
</source>
<match syslog.**>
  @type stdout
</match>
Your Error Log
No error is logged for <200>.
主要言語
Ruby
スター
13.6k
フォーク
1.4k
平均マージ
17時間 28分
マージ済み PR(30日)
66

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fluent/fluentd のほかの issue

fluent/fluentd の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。