This is the following json sample in which I want to filter and index on basis of Client Id and User Id which is in Message tag in json.
"message": "12 Jul 2016 15:28:14,851 http-bio-9080-exec-3 [INFO ] corporate_access - Request details - Uri: /corporate/create, Ip: x.x.x.x, User id: 12461, Client id:11048",
I want to index the user activity on basis of Client Id and User Id. My filter in logstash conf is :
filter {
grok {
match => {
"message" => "Uri: %{URIPATHPARAM:url}%{SPACE}Ip: %{IP:ip},%{SPACE}User id: %{WORD:Userid}, Client id:%{WORD:Clientid}"
}
}
}
You can use this grok filter:
Note: I have removed the
**aroundUser idandClient id, since it look like it was just to add emphasis on the interesting parts of the log line. But if you really have**in your logs, the pattern must be modified with:\*\*User id:\*\* %{NUMBER:user_id}, \*\*Client id:\*\*%{NUMBER:client_id}.