Splunk Search

Calculate duration between end of search time range and _time of record

richardAtOmni
Path Finder

Hello,

I would like to be able to calculate the time difference between the last time parameter of the time range of the search and the _time value of the record.

If the query is run from the current time, I would do something like this:

eval runtime_raw=(now()-_time)

But if the search time range end time is not now(), I want to replace now() in the above expression with something representing the end of the search time range. Does such a function exist? Or is there a way to calculate this?

Thanks for your help,

Richard

0 Karma

somesoni2
Revered Legend

You need to use addinfo command like this

your base search 
| addinfo 
| eval runtime_latest=info_max_time-_time | fields - info_*

https://docs.splunk.com/Documentation/SplunkCloud/6.6.3/SearchReference/Addinfo

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...