Splunk Search

How to find time range duration or value?

flow2k
Explorer

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

maciep
Champion

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!

Preparing your Splunk Environment for OpenSSL3

The Splunk platform will transition to OpenSSL version 3 in a future release. Actions are required to prepare ...

Deprecation of Splunk Observability Kubernetes “Classic Navigator” UI starting ...

Access to Splunk Observability Kubernetes “Classic Navigator” UI will no longer be available starting January ...

Now Available: Cisco Talos Threat Intelligence Integrations for Splunk Security Cloud ...

At .conf24, we shared that we were in the process of integrating Cisco Talos threat intelligence into Splunk ...