Splunk Search

bring column data to rows

Haleem
Engager

index=xxxx source=*xxxxxx*
| eval respStatus=case(responseStatus>=500, "ERRORS", responseStatus>=400, "EXCEPTIONS", responseStatus>=200, "SUCCESS" )
| stats avg(responseTime), max(responseTime) by client_id, servicePath, respStatus

The above query gives me the output as :

Haleem_0-1707168934624.png

I want to bring the respStatus column to split in 3 columns and should looks something like this:

Haleem_1-1707169004439.png

 

 

Want my table in this format :

 clientID | Service Path | Success count | Error Count | Exception Count | Avg Resp time | Max Resp time

Labels (3)
0 Karma
1 Solution

scelikok
SplunkTrust
SplunkTrust

Hi @Haleem,

Please try below;

 

index=xxxx source=*xxxxxx*
| stats avg(responseTime), max(responseTime), count(eval(respStatus >=500)) as "ERRORS", count(eval(respStatus >=400 AND respStatus <500)) as "EXCEPTIONS", count(eval(respStatus >=200 AND respStatus <400)) as "SUCCESS" by client_id servicePath

 

 

If this reply helps you an upvote and "Accept as Solution" is appreciated.

View solution in original post

0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @Haleem,

Please try below;

 

index=xxxx source=*xxxxxx*
| stats avg(responseTime), max(responseTime), count(eval(respStatus >=500)) as "ERRORS", count(eval(respStatus >=400 AND respStatus <500)) as "EXCEPTIONS", count(eval(respStatus >=200 AND respStatus <400)) as "SUCCESS" by client_id servicePath

 

 

If this reply helps you an upvote and "Accept as Solution" is appreciated.
0 Karma

Haleem
Engager

Thank you so much. I appreciate your help @scelikok . you're awesome !

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

From Data to Insight: Announcing the Winners of the Splunk Dashboard Contest

Hi Splunkers, First off, thank you to everyone who participated in our very first From Data to Insight: The ...

Splunk Developers: Construct Your Future at the .conf26 Builder Bar

Calling all Splunk architects, platform admins, and app developers: the site is open, and the blueprints are ...

Quick connection discovery mode for forwarders

When a Splunk forwarder loses connectivity to its indexers, it does not always reconnect immediately. In many ...