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
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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...