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!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...