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!

Event Series: Telemetry Pipeline Management

Balancing Scale and Spend: Gaining Control Over High-Volume Metrics in Splunk Observability Cloud As ...

Kick the Tires Before You Commit: A Hands-On Tour of the Splunk Observability Cloud ...

Evaluating an enterprise observability platform usually goes like this: fill out a form, get a free trial with ...

Deep insights, no barriers: Splunk Observability Cloud Free Edition

As software delivery cycles continue to accelerate, observability shouldn’t be a luxury — it should be a ...