I have the following log and I need to filter only salePoint from it.
"GET /supero/global/grocery/fullgrainMenu.jsp?id=cat12216&salePoint=0012FT&locale=es_ES&version=0510091431 HTTP/1.1"
I tried \"(%{NOTSPACE:request}(?:&salePoint=%{DATA:salePoint})?)\"
but it giving wrong output
"salePoint": "0012FT&locale=es_ES&version=0510091431 HTTP/1.1"
Expected output is "salePoint": "0012FT
Thanks
Since the question specified that the intention is to find and filter only salePoint, you can use the following grok pattern:
(%{GREEDYDATA:before})?(salePoint=%{WORD:salePoint})(%{GREEDYDATA:after})?
Explanation :
As always you can use add more to the pattern if you need to filter out more fields.
Example :
"GET /supero/global/grocery/fullgrainMenu.jsp?id=cat12216&salePoint=0012FT&locale=es_ES&version=0510091431 HTTP/1.1"
With the above pattern output is :
{
"before": [
[
""GET /supero/global/grocery/fullgrainMenu.jsp?id=cat12216&"
]
],
"salePoint": [
[
"0012FT"
]
],
"after": [
[
"&locale=es_ES&version=0510091431 HTTP/1.1""
]
]
}
Please use Grok Debugger to play around with the pattern.