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

Abierto Apto para principiantes
#5,632 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
74/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
ruby
Área
backend

Línea de trabajo

Empieza en lib/fluent/plugin/in_syslog.rb, en la asignación de PRI a etiqueta mencionada en el issue, y sigue cómo se analiza PRI tanto con la configuración predeterminada como con with_priority false. Revisa las pruebas existentes para mensajes syslog no válidos y añade cobertura para valores de PRI superiores a 191 en ambos modos. La tarea estará terminada cuando los valores de PRI no válidos generen advertencias y no se emitan, mientras que el PRI válido 191 siga funcionando.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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>.
Lenguaje dominante
Ruby
Estrellas
13.6k
Forks
1.4k
Merge medio
17 h 28 min
PR fusionados (30 d)
66

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de fluent/fluentd

Todos los issues de fluent/fluentd

Issues similares

Más issues de Ruby

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.