Splunk Search

Search Query when having multiple right boundaries.

xvxt006
Contributor

Hi i would like to get the commands from the below pattern. For example i am looking for search, content, gcom.suggestions.json, etc.

i have used the below query. In the rex i have mentioned to capture (at least i wanted to be) uri part which starts with / and ends with either ? (urls other than /content) or space (for /content uri there is nothing after this). But it is not working properly. Is this how this should be done? when you have multiple left and right boundaries.

sourcetype=access_combined_wcookie host=qalws* LR_VPT_HYBRIS | rex field=uri "(?i)/(?P<command>[\?|\s)" | top limit=100 command


167.115.210.254 - - [18/Dec/2012:11:29:59 -0600] "POST /search?searchQuery=RELAYS%20%20ELECTRIC* HTTP/1.1" 
167.115.210.254 - - [18/Dec/2012:11:29:59 -0600] "GET /content HTTP/1.1" 
167.115.210.254 - - [18/Dec/2012:11:29:59 -0600] "GET /content HTTP/1.1" 
167.115.210.254 - - [18/Dec/2012:11:29:59 -0600] "GET /content/homepage HTTP/1.1" 
167.115.210.254 - - [18/Dec/2012:11:29:59 -0600] "GET /gcom.suggestions.json?selectedText=TAPE%20*&start=0&count=Infinity HTTP/1.1" 
167.115.210.254 - - [18/Dec/2012:11:29:59 -0600] "POST /search?searchQuery=ADAPTER* HTTP/1.1" 
167.115.210.254 - - [18/Dec/2012:11:29:59 -0600] "GET /content/homepage HTTP/1.1" 
167.115.210.254 - - [18/Dec/2012:11:29:59 -0600] "POST /search?searchQuery=HYDRAULICS* HTTP/1.1" 
167.115.210.254 - - [18/Dec/2012:11:29:59 -0600] "POST /search?searchQuery=COPPER%20TUBING* HTTP/1.1" 
167.115.210.254 - - [18/Dec/2012:11:29:59 -0600] "GET /gcom.suggestions.json?selectedText=BEARING|*&start=0&count=Infinity HTTP/1.1" 
Tags (1)
0 Karma

xvxt006
Contributor

Hi, I have tired and it is working but i wanted to exclude resources like js, css, img, etc.
Si have added this uri != "(?i).*.(?:js|css|png|img|png)" anything needs to be corrected in that?

sourcetype=access_combined_wcookie host=qalws* LR_VPT_HYBRIS uri != "(?i)..(?:js|css|png|img|png)" | rex field=uri "/(?P.?)[?\"]" | top limit=500 command

0 Karma

xvxt006
Contributor

Thank you. I will try that.

0 Karma

lguinn2
Legend
sourcetype=access_combined_wcookie host=qalws* LR_VPT_HYBRIS 
| rex field=uri "/(?P<command>.*?)[?\"]"

should work

ppuru
Path Finder

I have been trying to achieve this and it seems I was missing ? after .*
Your comment helped me.

0 Karma
Get Updates on the Splunk Community!

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...

Splunk AppDynamics Agents Webinar Series

Mark your calendars! On June 24th at 12PM PST, we’re going live with the second session of our Splunk ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2025 SplunkTrust is officially open! If you ...