logstash-5.x gelf 输入多行编解码器不起作用

logstash-5.x gelf input multiline codec doesn't work

我有一个简单直接的配置,但我不确定我在尝试让这个多线工作时做错了什么。

input {
    gelf {
        codec => multiline {
            pattern => "^%{TIMESTAMP_ISO8601} "
            negate => true
            what => "previous"
        }
    }
}

filter {}

output {
    # I have the relevant ES hosts & index here
    elasticsearch { }
    stdout {
        codec => rubydebug
    }
}

我正在如下测试它,我得到单行,多行标记没有被添加,我在 logstash 调试日志中看到事件一个接一个地通过过滤器。

docker run -it --log-driver gelf --log-opt gelf-address=udp://127.0.0.1:12201 \
    --log-opt tag=mline-test python:alpine \
    python -c 'print("[2017-10-18 00:00:00,000] Hello world");assert False'

我发现 gelf 输入插件中的编解码器被忽略了:logstash-plugins/logstash-input-gelf#37

这意味着 gelf 的唯一多行选项是使用 logstash-2.4 并影响单线程性能。

Settings: Default pipeline workers: 4
Defaulting pipeline worker threads to 1 because there are some filters that might not work with multiple worker threads {:count_was=>4, :filters=>["multiline"], :level=>:warn}
Pipeline main started