I'm having some trouble with logstash grok filter. Specifically matching the log to a pattern.
Say I have two log messages that looks something like this:
10.12.6.190 [Thu, 24 Sep 2015 18:17:52 GMT] 404 -
192.168.48.207 [Thu, 24 Sep 2015 18:20:12 GMT] 200 1234
(redacted info that is not needed)
Here are my issues:
- I haven't been able to find a DATESTAMP pattern that matches this datetime (I tried DATESTAMP_RFC2822 but kept getting grokparsefailure),
- Notice that if I use a grok pattern that looks like this:
%{IPORHOST:clientip} [%{GREEDYDATA:timestamp}] %{NUMBER:response:int} %{NUMBER:bytes}
the %{NUMBER:bytes} pattern will fail on the second log.
Here are my questions:
- Does anybody know of a pattern that will match this datestamp?
- Should I use something like %{GREEDYDATA:bytes} and try to coerce it to a number later on, or is there some conditional I can use like '%{NUMBER:bytes}|-' ? Note I'd prefer not to do a multi match here just for this one case, seems like duplicating too much. As these cases grow the combinatorics of all of the possible scenarios just seems message to have to handle in a multi match / multi pattern way.
- I think I've found all of the easily accessible resources like:
https://github.com/logstash-plugins/logstash-patterns-core/tree/master/patterns
http://grokdebug.herokuapp.com/
https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html
but I'm still not clicking with grok too well. I think what I'd really benefit from is complex example logstash configurations with the log files they are meant to parse. Does anybody know of a resource like this?
thanks,j