Splunk Search

Obtaining the search time range in a custom search command

radu_groupon
New Member

I have a custom command that takes in the input from a search command and I would like to make available in that command the time range over which the search was executed.
Right now, I am using the splunk rest api querying extracting the information using the search id but it takes as much as the original search to extract that information.
Is there any other way to obtain that information ? I am looking for the equivalent of searchEarliestTime and searchLatestTime

Tags (1)
0 Karma

Ledion_Bitincka
Splunk Employee
Splunk Employee

You can ask the search framework to pass you a copy of the contents of info.csv by testing the following flag in commands.conf, you can then read the contents of the csv file and look for the _search_et and _search_lt fields in the first csv record. (If those fields are missing then the search is an all time search)

requires_srinfo = [true|false]
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...