Splunk Search

how to search event occurrence in the span of 0 to 2 seconds and 2 to 5 seconds and above 10 seconds

john_q
Explorer

i have a data which consists of multiple exceptions . so i have to figure out how many exceptions are occurred like 0 to 2 seconds and 2 to 5 seconds and 5 to 10 seconds timerenge in the span of last 24 hours. can you please tell me the search query . thanks in advance

i want to show output like:

ExcepitonsCount_0to2sec ExcepitonsCount_2to5sec ExcepitonsCount_5to10sec ExcepitonsCount_above10sec
101 102 103 104

Tags (1)
0 Karma
1 Solution

renjith_nair
Legend

Hi @john_q,

Does this work for you ?

"your search to filter exceptions"|timechart span=1s count|streamstats count as sec
|stats sum(eval(if(sec<3,count,null()))) as ExcepitonsCount_0to2sec ,sum(eval(if(sec>2 AND sec<6,count,null()))) as ExcepitonsCount_2to5sec ,sum(eval(if(sec>5 AND sec<11,count,null()))) as ExcepitonsCount_5to10sec ,sum(eval(if(sec>10,count,null()))) as ExcepitonsCount_above10sec
---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

0 Karma

renjith_nair
Legend

Hi @john_q,

Does this work for you ?

"your search to filter exceptions"|timechart span=1s count|streamstats count as sec
|stats sum(eval(if(sec<3,count,null()))) as ExcepitonsCount_0to2sec ,sum(eval(if(sec>2 AND sec<6,count,null()))) as ExcepitonsCount_2to5sec ,sum(eval(if(sec>5 AND sec<11,count,null()))) as ExcepitonsCount_5to10sec ,sum(eval(if(sec>10,count,null()))) as ExcepitonsCount_above10sec
---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...