parser_syslog: string parser raises NoMethodError on some malformed messages
Los mantenedores suelen responder en 1 día
Ya se ha fusionado un pull request relacionado.
- #5589 de @yuminn-k — fusionado
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- ruby
- Área
- backend, backend-api-design
Línea de trabajo
Empieza leyendo las rutas del parser de cadenas para RFC3164 y RFC5424 y compara cómo manejan los encabezados mal formados con el comportamiento del parser de expresiones regulares descrito aquí. Reproduce las tres entradas del issue, incluida la línea UTF-8 de RFC5424. El objetivo se cumple cuando el parser de cadenas ya no lanza excepciones y las entradas se analizan o se emiten como líneas sin coincidencia, tal como se describe.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
With parser_engine string, parser_syslog raises NoMethodError on some malformed messages that are not truncated. #5584 covers truncated messages. These are different code paths.
- RFC3164: the ident ends with
]but has no[. The parser subtracts from thenilresult oftext.index('[', cursor). - RFC5424: the header contains a non-ASCII character, STRUCTURED-DATA is
-, and there is no MSG. The parser comparescursor, a character index, withtext.bytesize. They differ, so it slices past the end and callschomp!onnil.
| Input | message_format |
string | regexp |
|---|---|---|---|
<14>Apr 25 16:43:29 host app]: message |
rfc3164 |
undefined method '-' for nil |
ident app], message message |
<14>Apr 25 16:43:29 host app] message |
rfc3164 |
undefined method '-' for nil |
ident app], message message |
<14>1 2026-04-25T16:43:29Z ホスト app 123 ID - (UTF-8) |
rfc5424 |
undefined method 'chomp!' for nil |
unmatched |
Because the parser raises, in_tail drops these lines with invalid line found even when emit_unmatched_lines is enabled. The second case needs a UTF-8 string, for example in_tail with encoding UTF-8 or filter_parser on a UTF-8 field.
To Reproduce
-
Create
/tmp/rfc3164.logwith these lines:<14>Apr 25 16:43:29 host app]: message <14>Apr 25 16:43:29 host app] message -
Create
/tmp/rfc5424.logwith this line in UTF-8:<14>1 2026-04-25T16:43:29Z ホスト app 123 ID - -
Run Fluentd with the configuration below.
Expected behavior
The parser does not raise. The RFC3164 lines are parsed as with parser_engine regexp, or reported as unmatched. The RFC5424 line is emitted as unmatched_line, as with parser_engine regexp.
Actual: all three lines are dropped with invalid line found.
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/rfc3164.log
pos_file /tmp/rfc3164.log.pos
read_from_head true
emit_unmatched_lines true
tag rfc3164
<parse>
@type syslog
message_format rfc3164
with_priority true
parser_engine string
</parse>
</source>
<source>
@type tail
path /tmp/rfc5424.log
pos_file /tmp/rfc5424.log.pos
read_from_head true
emit_unmatched_lines true
encoding UTF-8
tag rfc5424
<parse>
@type syslog
message_format rfc5424
with_priority true
parser_engine string
</parse>
</source>
<match **>
@type stdout
</match>
Your Error Log
[warn]: invalid line found file="/tmp/rfc3164.log" line="<14>Apr 25 16:43:29 host app]: message" error="undefined method '-' for nil"
[warn]: invalid line found file="/tmp/rfc3164.log" line="<14>Apr 25 16:43:29 host app] message" error="undefined method '-' for nil"
[warn]: invalid line found file="/tmp/rfc5424.log" line="<14>1 2026-04-25T16:43:29Z ホスト app 123 ID -" error="undefined method 'chomp!' for nil"
Additional context
The RFC3164 case exists since v1.7.1. The RFC5424 case exists since v1.11.0.
- Lenguaje dominante
- Ruby
- Estrellas
- 13.6k
- Forks
- 1.4k
- Merge medio
- 1 d 4 h
- PR fusionados (30 d)
- 56
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de fluent/fluentd
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
parser_syslog: string parser ends RFC5424 structured data at an escaped "]"Posiblemente ocupada @yuminn-k la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
bug enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
fluent/fluentd#5494 · 2 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
Todos los issues de fluent/fluentd
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
nesquena/steward-os#79 ·
Los mantenedores suelen responder en 1 día
-
area/tech debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
voxpupuli/json-schema#585 ·
-
[Bug] Time search attributes lose sub-second precision, and raise NoMethodError without `require 'time'`Posiblemente ocupada @RaphaelFakhri la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
temporalio/sdk-ruby#653 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
bridgetownrb/bridgetown#1134 ·