Grok support for extractors
When it comes to parsing complex (read:crappy) log formats Jordan Sissel hit a homerun with the concepts and ideas behind Grok.
I have tried plain regex'es and drools but neither can match the ease, speed, and maintainability of grok patterns.
As a bonus it would enable a lot of transparency between Logstash and Graylog2.
Parsing crappy syslog like this :
srvesbmanxxxx api-log: 2014-01-15 14:46:33,382 INFO [cloud.api.ApiServer] (catalina-exec-13:null) (userId=x accountId=x sessionId=3A0E966E2xxxxxx) 10.x.x.x -- GET command=queryAsyncJobResult&jobId=b74d9ce1-0423-4a3e-b460-217787cf0681&response=json&sessionkey=0WfyV4trvb5ng6XrRLCAxHx3KOA%3D&_=1389793597907 200 { "queryasyncjobresultresponse" : {"accountid":"xxxxx-xxxx-11e3-bbe0-235130fb5cd9","userid":"xxxxx-60d0-xxxx-bbe0-235130fb5cd9","cmd":"org.apache.cloudstack.api.command.admin.storage.PreparePrimaryStorageForMaintenanceCmd","jobstatus":1,"jobprocstatus":0,"jobresultcode":0,"jobresulttype":"object","jobresult":{"storagepool":{"id":"xxxxxx-f3ca-3ed7-9ae2-6d79a56d3e90","zoneid":"xxxxxx-99cc-4ab6-a009-04a15d3ccd0a","zonename":"DCE-POC1","podid":"xxxxxxx-b4f7-4994-bd2f-9391e8fbd6d5","podname":"RACK5-DCE_POC1","name":"PR_NP0","ipaddress":"xxx.xxx.xxx.xxx","path":"/ds0002_nfs_fc","created":"2014-01-15T14:46:19+0100","type":"NetworkFilesystem","clusterid":"xxxxx-b113-4dbc-8301-1fd8ce1f5a60","clustername":"xxx.xxx.3.250/DCE_Zone_1/DCE_POC1","disksizetotal":1099511627776,"disksizeallocated":0,"tags":"PR_NP_0","state":"Maintenance","scope":"CLUSTER","jobid":"xxxxx-0423-4a3e-b460-217787cf0681","jobstatus":0}},"created":"2014-01-15T14:46:30+0100","jobid":"xxxx-0423-4a3e-b460-217787cf0681"} }
took 2 minutes using something like this :
%{HOSTNAME:host} %{NOTSPACE:log-type} %{NOTSPACE:date} %{NOTSPACE:time} %{WORD:level} %{NOTSPACE:path} %{NOTSPACE:thread} %{NOTSPACE:userid} %{NOTSPACE:accountid} %{NOTSPACE:sessionid} %{IP:ip} -- %{WORD:method} %{NOTSPACE:command} %{INT:status_code} %{GREEDYDATA:request}
:+1:
+1
+1
+∞
+1
Grok conversion (int and float) could be also implemented. E.g. %{NUMBER:num:int} or %{NUMBER:amount:float}
+1
https://github.com/Graylog2/graylog2-server/commit/de30ca6934d6a2d3a90219b3d66bd2e8fdcc16c2
Can you add default's patterns (as logstash do : https://github.com/elasticsearch/logstash/tree/v1.4.0/patterns) ?
@sebclick we will likely not ship with default patters, but you can now import pattern files with two clicks.
that will be available in beta.2
@kroepke Nice :smile:
has been implemented in way too many commits.
Brilliant feature, thank you!