Open cwurm opened 7 years ago
I'm hitting this issue too, using the multiline
codec on the stdin
input, my final log entry is lost.
I am hitting same issue too +1 when multiline codec with stdin input is used.
I just ran into this issue using multiline
codec on the file
input. Same exact thing.
When sending data that includes a multiline at the very end, the multiline will be dropped by this codec.
For example, this affects every file being read with the
stdin
orfile
inputs (see below for mitigation when usingfile
).Example
stacktrace.log:
logstash.javastacktrace.conf:
Output:
Why?
The codec will buffer lines matching a multiline pattern, but not output them until it encounters a line not matching the multiline pattern.
While a
flush
method is implemented, it will never be called by Logstash: https://github.com/elastic/logstash/issues/6523Mitigation
Setting
auto_flush_interval
helps for inputs that don't exit (e.g.file
, but notstdin
).However, it introduces a race condition - if the input or Logstash dies before the data is auto flushed it will still be lost.