Splunk Search

How do I query the percentage of unique sessions seeing errors?

cochang
New Member

I'm trying to come up with a query that's a percentage of users (via session ids) experiencing errors. i can find the number of unique sessions with index="my-index" | stats dc(session_id) and the number of unique users seeing errors with index="my-index" category="error" | stats dc(session_id), but I can't seem to bring these two numbers together and make a ratio. Any recommendations?

Tags (2)
0 Karma
1 Solution

whrg
Motivator

Hello @cochang,

Try using the appendcols command:

index="my-index" | stats dc(session_id) as total_sessions
| appendcols [search index="my-index" category="error" | stats dc(session_id) as error_sessions]
| eval percentage=round(error_sessions/total_sessions*100,2)."%"

View solution in original post

0 Karma

whrg
Motivator

Hello @cochang,

Try using the appendcols command:

index="my-index" | stats dc(session_id) as total_sessions
| appendcols [search index="my-index" category="error" | stats dc(session_id) as error_sessions]
| eval percentage=round(error_sessions/total_sessions*100,2)."%"
0 Karma
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...