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!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...