Splunk Search

Group results by range values

tyronetv
Communicator

I'm sure there is probably an answer this in the splunk base but I am having issues with what I want to call what I am attempting to do so therefore searching on it is somewhat difficult. 🙂

Essentially I want to pull all the duration values for a process that executes multiple times a day and group it based upon performance falling withing multiple windows. I.e. "Fastest" would be duration < 5 seconds. "Fast" would be duration 5 seconds or more but less than, say, 20. "Slow" would be anything 20 seconds or longer but less than, say, a minute, or 60 seconds, and "Painful" would be anything 60 seconds or longer.

Essentially a report of

===============

|Group Class | Count |

| Fastest | 1987 |

| Fast | 500 |

| Slow | 27 |

| Slowest | 5 |

Ideas?

Tags (2)
1 Solution

jonuwz
Influencer

Something like this (assuming the field your interested in is called 'dur') :

<your search here> 
| eval speed=case(dur<5,"Fastest",dur<20,"Fast",dur<60,"Slow",1=1,"Painful)
| stats count by speed

The case statement exits on the 1st match, so the last statement :

1=1,"Painful"

acts as a default

View solution in original post

moisesroth
Path Finder

Another solution is to group by range, e.g:
search | chart count by duration span=5

the_wolverine
Champion
search | rangemap field=duration Slowest=0-5 Slow=5-27 Fast=27-500 Fastest=500-10000

martin_mueller
SplunkTrust
SplunkTrust

I believe it's the other way round, low durations are fastest

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Rangemap? 🙂

0 Karma

jonuwz
Influencer

Something like this (assuming the field your interested in is called 'dur') :

<your search here> 
| eval speed=case(dur<5,"Fastest",dur<20,"Fast",dur<60,"Slow",1=1,"Painful)
| stats count by speed

The case statement exits on the 1st match, so the last statement :

1=1,"Painful"

acts as a default

Get Updates on the Splunk Community!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...