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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...