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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...