Splunk Search

How to find time range duration or value?


In searching, I understand that I can specify the time range using one of the presets (like "Last 4 hours") or set it with SPL (e.g., earliest=10/19/2017:0:0:0 latest=10/27/2017:0:0:0).

My question is different. Is there a variable that can tell me what the duration of the time range being used is? For example, if I used "Last 4 hours", I would expect this field to tell me 240 minutes, and if I used "Last 60 minutes", I would expect the field is tell me 60 minutes.

Motivation for this question: I would like to compute the aggregate queries per second over some time range, so I could just do stats count | eval queriesPerSecond=count/durationVar

0 Karma


you could pipe to the addinfo command, which will add fields for info_min_time and info_max_time to your events. And then you could do the math from there. Of course, you'd have to determine how to handle odd scenarios like "All Time"...

Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In the last month, the Splunk Threat Research Team (STRT) has had 2 releases of new security content via the ...

Announcing the 1st Round Champion’s Tribute Winners of the Great Resilience Quest

We are happy to announce the 20 lucky questers who are selected to be the first round of Champion's Tribute ...

We’ve Got Education Validation!

Are you feeling it? All the career-boosting benefits of up-skilling with Splunk? It’s not just a feeling, it's ...