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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...