Splunk Search

How to use the time picker $earliest$ and $latest$ time set by the user in my custom Python search command?

johannesschilli
Engager

Hi,

I'm trying to use the $earliest$ and $latest$ time set by the user time picker in my custom search command. I'm using the Python SDK 1.5.0 for this.
I found the input_header field of the SearchCommand class, but it doesn't contain the information I'm looking for.
Is this information available to custom search commands in any way? I'd like to have something like the results produced by the addinfo command.

Thanks for ideas!

0 Karma

rivaanbechan
Engager

Hi,

Here is an example of how you get to these variables:

search_results = self.search_results_info
earliest = int(search_results.search_et)
latest = int(search_results.search_lt)

Hope this helps!
Rivaan

Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...