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!

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to Officially Supported Splunk ...