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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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