I want to add fields for specific URI params in my log lines
here is an example log line:
2017-03-12 21:34:36 W3SVC1 webserver 1.1.1.1 GET /webpage.html param1=11111¶m2=22222¶m3=¶m4=4444444 80 - 2.2.2.2 HTTP/1.1 Java/1.8.0_121 - - balh.com 200 0 0 311 244 247 - -
I want to add fields for param1, param2, param3 and param4.
I am using this grok filter:
grok {
match => [ "message", "(?<param1>param1=(.*?)&)"]
}
So this regex uses a capture group to get text between "param1=" and "&". But grok is ignoring the capture group and getting "param1=11111&" I just want to capture the "111111"
How can I say use capture group 1 or tell grok to use my regex capture group?
Edit This almost works:
grok {
match => [ "message", "(?<param1>param1=(?<param1>.*?)&)"]
}
So I guess what I'm doing here is using two named groups but with the same name. The problem is that the "param1" field has two entries in it for each group. One for "param1=11111&" and one for "11111". How do I just get that second group?