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!

Announcing Scheduled Export GA for Dashboard Studio

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

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...