I have a very long logstash grok filter:
match => { 'message' => '%{MONTH:month} %{NUMBER:day} %{TIME:time} %{WORD:log_host} %{WORD:generator}\[%{NUMBER:unknown}\]: %{IP:connIP}:%{NUMBER:connPort} \[.*\] %{WORD:namespace}\~? %{NOTSPACE:unknown} %{NOTSPACE:unknown} %{NUMBER:res_statuscode} %{NUMBER:unknown} (?<unknown>\-.*\-) %{NOTSPACE:unknown} %{NOTSPACE:unknown} \"%{WORD:method} %{PATH:path} %{DATA:httpversion}\"' }
Any way to break this up over multiple lines? I tried the following:
match => { 'message' => '%{MONTH:month} %{NUMBER:day} %{TIME:time} %{WORD:log_host}'
' %{WORD:generator}\[%{NUMBER:unknown}\]: %{IP:connIP}:%{NUMBER:connPort}'
' \[.*\] %{WORD:namespace}\~? %{NOTSPACE:unknown} %{NOTSPACE:unknown}'
' %{NUMBER:res_statuscode} %{NUMBER:unknown} (?<unknown>\-.*\-) %{NOTSPACE:unknown}'
' %{NOTSPACE:unknown} \"%{WORD:method} %{PATH:path} %{DATA:httpversion}\"' }
But it's giving me errors, even separating the strings with commas doesn't work: {:timestamp=>"2016-09-30T08:38:50.549000+0000", :message=>"fetched an invalid config" ...
There's no mention of handling this in the official documentation:
;)). Another idea would be to use a custom pattern file (cf doc), which could be easier to read, if you use a few patterns and use them instead in your grok filter - baudsp