2
對於Logstash 2.3.3,grok過濾器不適用於最後一個字段。Logstash grok過濾器不適用於最後一個字段
要重現該問題,創建test.conf
如下:
input {
file {
path => "/Users/izeye/Applications/logstash-2.3.3/test.log"
}
}
filter {
grok {
match => { "message" => "%{DATA:id1},%{DATA:id2},%{DATA:id3},%{DATA:id4},%{DATA:id5}" }
}
}
output {
stdout {
codec => rubydebug
}
}
運行./bin/logstash -f test.conf
,並開始後,在另一端運行echo "1,2,3,4,5" >> test.log
和我得到了以下的輸出:
Johnnyui-MacBook-Pro:logstash-2.3.3 izeye$ ./bin/logstash -f test.conf
Settings: Default pipeline workers: 8
Pipeline main started
{
"message" => "1,2,3,4,5",
"@version" => "1",
"@timestamp" => "2016-07-07T07:57:42.830Z",
"path" => "/Users/izeye/Applications/logstash-2.3.3/test.log",
"host" => "Johnnyui-MacBook-Pro.local",
"id1" => "1",
"id2" => "2",
"id3" => "3",
"id4" => "4"
}
你可以看到失蹤的id5
。
我不確定這是一個錯誤還是錯誤配置。
任何提示將不勝感激。
謝謝!我沒有檢查它的值:https://github.com/logstash-plugins/logstash-patterns-core/blob/master/patterns/grok-patterns –