Splunk Search

Group results based on criteria

mcvr
New Member

Hi Peeps,

source="Log.txt" resp_status=503 | chart count by req_url

If I execute the above query I will get the following results

/account/signin.jsp
/account/signin.jsp?FOLDER%3C%3Efolder_id=253437430373429
/account/signin.jsp?FOLDER%3C%3Efolder_id=2534374303734299
/account/track_your_order.jsp
/checkout/shoppingbag.jsp?FOLDER%3C%3Efolder_id=2534374303724558&PRODUCT%3C%3Eprd_id=845524442909193
/checkout/shoppingbag.jsp?FOLDER%3C%3Efolder_id=2534374303724558&PRODUCT%3C%3Eprd_id=845524442909193
/checkout/shoppingbag.jsp?FOLDER%3C%3Efolder_id=2534374303724558&PRODUCT%3C%3Eprd_id=845524443476873
/checkout/shoppingbag.jsp?FOLDER%3C%3Efolder_id=2534374303724558&PRODUCT%3C%3Eprd_id=845524443483800
/checkout/shoppingbag.jsp?FOLDER%3C%3Efolder_id=2534374303724558&PRODUCT%3C%3Eprd_id=845524443483876
/checkout/shoppingbag.jsp?FOLDER%3C%3Efolder_id=2534374303724558&PRODUCT%3C%3Eprd_id=845524443483876
/checkout/shoppingbag.jsp?FOLDER%3C%3Efolder_id=2534374303724558&PRODUCT%3C%3Eprd_id=845524443483876
/checkout/shoppingbag.jsp?FOLDER%3C%3Efolder_id=2534374303724558&PRODUCT%3C%3Eprd_id=845524443483876

I want to group all the shoppingbag.jsp results to one category and their total count so that I will understand that the shoppingbag page for various products were returing 503 in total

Tags (2)
0 Karma

elliotproebstel
Champion

A quick regex should do the trick:
| rex field=req_url "(?<url_base>[^\?]+)"

So your full query will be:
source="Log.txt" resp_status=503 | rex field=req_url "(?<url_base>[^\?]+)" | chart count by url_base

0 Karma
Get Updates on the Splunk Community!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...