Reporting

Set the earliest time for a scheduled search to the last search time

the0duke0
Path Finder

Is it possible to set the earliest time for a scheduled search to be the last time the scheduled search ran? For example I know I can run a search every hour over the last hour (perhaps with some overlap) but if for some reason that search doesn't run for one or more hours the data would be missed. It would be great if there was some way to retrieve the last run time and use it in the earliest statement.

Thanks!

0 Karma
1 Solution

somesoni2
Revered Legend

Give this a try

index=foo sourcetype=bar latest=@h [ search index=_internal sourcetype=scheduler savedsearch_name="PutYourSavedSearchName" status=success earliest=-6h | stats max(scheduled_time) as earliest ] | rest of the search

Above search will look through last successful execution timestamp of the saved search and use as earliest.

View solution in original post

somesoni2
Revered Legend

Give this a try

index=foo sourcetype=bar latest=@h [ search index=_internal sourcetype=scheduler savedsearch_name="PutYourSavedSearchName" status=success earliest=-6h | stats max(scheduled_time) as earliest ] | rest of the search

Above search will look through last successful execution timestamp of the saved search and use as earliest.

chinmayc469
Explorer

what will be the earliest time for the first run of the scheduled search?

0 Karma

the0duke0
Path Finder

Exactly what I was looking for, thank you!

0 Karma
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 ...