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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...