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
Get Updates on the Splunk Community!

Celebrating Fast Lane: 2025 Authorized Learning Partner of the Year

At .conf25, Splunk proudly recognized Fast Lane as the 2025 Authorized Learning Partner of the Year. This ...

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...