Splunk Search

How to exclude page resources in the search results

xvxt006
Contributor

Hi, i am using the below search query to get uri commands from the access logs. But result includes page resources as well (js, imgs, css etc). I want to exclude these. How can i do that?

Basically i want to exclude any uri which ends with (.js, .css, .img, etc). How can i add that condition to the below query?

sourcetype=access_combined_wcookie host=qalws* LR_VPT_HYBRIS | rex field=uri "/(?P.*?)[?/\"]" | top limit=5000 command

Tags (1)
0 Karma
1 Solution

jonuwz
Influencer

Example to exclude js and css files

index=_* sourcetype="splunk_web_access" NOT ( uri=*.js OR uri=*.css) | table uri

So you should be good to just modify your main search as follows :

sourcetype=access_combined_wcookie host=qalws LR_VPT_HYBRIS NOT (uri=*.js OR uri=*.css OR uri=*.img)

View solution in original post

jonuwz
Influencer

No problem - feel free to accept the answer if it worked for you

0 Karma

xvxt006
Contributor

Awesome. Thank you both. it is working fine. I was doing uri!= and it did not give me proper results. Thanks for your help.

0 Karma

jonuwz
Influencer

Example to exclude js and css files

index=_* sourcetype="splunk_web_access" NOT ( uri=*.js OR uri=*.css) | table uri

So you should be good to just modify your main search as follows :

sourcetype=access_combined_wcookie host=qalws LR_VPT_HYBRIS NOT (uri=*.js OR uri=*.css OR uri=*.img)
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...