Logstash grok pattern for space field

user6826691 picture user6826691 · Mar 27, 2017 · Viewed 15.6k times · Source

Hi How to write a grok expression for the below log

[2017-03-25T00:00:07,137][WARN ]

match => { "message" => "\[%{TIMESTAMP_ISO8601:timestamp}/]/[%{LOGLEVEL:log-level}\s*\]" }

Is this correct , how to write space in grok ? Thanks

Answer

fylie picture fylie · Mar 27, 2017

%{SPACE} is that pattern that matches 0 or more spaces, which is very useful if you don't know (or care!) if there will be a space or not.