Splunk Search

How can I refer to the chosen timescale within my search?

seanel
Path Finder

To work around another issue with reporting average counts by time (See here ) I would like to instead use the chosen timespan of the search in an eval.

For instance I might have earliest=-7d latest=now and then do an eval to calculate that there is 10080 minutes in this particular search (which will enable me to do accurate averages per minute instead of the skewed results I get in the link above.

I have tried things like eval mins=earliest-latest/60 and eval mins=earliestTime-latestTime/60 but nothing seems to work

Tags (2)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

Add the addinfo command to your search, it'll give you fields info_min_time and info_max_time with the epoch timestamps of your time range.

http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/addinfo

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

Add the addinfo command to your search, it'll give you fields info_min_time and info_max_time with the epoch timestamps of your time range.

http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/addinfo

seanel
Path Finder

haha - figured the same thing out and was coming back to answer my own question 🙂 Many thanks!

So to solve my problem I have added |addinfo | eval totalmins=(info_max_time-info_min_time)/60 and have all I need to work around the issue in the linked post 🙂

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!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

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 ...