Splunk Search

Is it possible, within the same search, to find the count of events where the transaction duration is greater than and less than the average?

vamshi245
New Member

I am trying to get the count of events where the transaction duration is above the average duration and below the average duration.

below is my search to find out the count of events above the average transaction duration:

index=whatever*  sourcetype="Source"  "COMPONENTNAME=X" AND "EVENT=Received"|eval receivedtime=SERVER_TIME |join type=inner ORDERNUMBER max=0[search index=tas_prod  sourcetype="TAS:FUSION:ProdSupport:PRD:AuditDB"  "COMPONENTNAME=Y" AND "EVENT=Delivered"|eval deliveredTime=SERVER_TIME ]|eval diff = deliveredTime-receivedtime| eventstats avg(diff) as Avg | where diff>Avg| stats count as Grt

is it possible to get the count of transactions with diff < Avg in the same search? like:

searchStatement|eval diff = deliveredTime-receivedtime| eventstats avg(diff) as Avg | where diff>Avg| stats count as Grt | where diff < Avg |stats count as Lsr

please let me know if i can combine the count without using the same search statement another time to find the count for less than average

0 Karma
1 Solution

sundareshr
Legend

You could try this

.... | stats count(eval(diff>Avg)) as Grt count(eval(diff<Avg)) as Lsr

View solution in original post

0 Karma

sundareshr
Legend

You could try this

.... | stats count(eval(diff>Avg)) as Grt count(eval(diff<Avg)) as Lsr
0 Karma

vamshi245
New Member

thanks this worked.

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...