Deployment Architecture

Using the number of events in bins to find percentile

jonnymolina
Engager

Hello all,

I have a seemingly simple goal: bucketing events by time and finding the 95th percentile using the total number of events in each bin. I'm able to get the counts for each bin but I'm not sure how to use each of those counts and find the percentile using p().

This is how I'm getting the count for each bin:
| bin _time span=5m | stats count by _time

Now I want to use the values in the count column as an input list to calculate p95().

Thanks for the help in advance.

0 Karma
1 Solution

renjith_nair
Legend

@jonnymolina,

Does it work for you ?

index=_internal |bucket span=5m _time|stats count by _time|eventstats perc95(count) as p95
---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

renjith_nair
Legend

@jonnymolina,

Does it work for you ?

index=_internal |bucket span=5m _time|stats count by _time|eventstats perc95(count) as p95
---
What goes around comes around. If it helps, hit it with Karma 🙂

jonnymolina
Engager

I also figured out you can return a single p95 value by doing

| bin _time span=5m | stats count by _time | stats perc95(count) as p95

0 Karma

renjith_nair
Legend

you could do that as well if you only need p95 , all other fields will be gone. Evenstats is used to keep all the fields in the output

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

jonnymolina
Engager

This works! Thank you so much. As a side topic, could this be achieved through streamstats as well?

0 Karma

renjith_nair
Legend

I wouldn't do it with streamstats because its specially created for creating "streaming" events where as eventstats acts on the events by events

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

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 ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...