Splunk Search

cron schedule to run for every 5 minutes but not at 3-4PM on Saturday?

uhkc777
Explorer

Hi,

I need a cron Schedule which has to run at every 5 mins on all days except 3-4PM on Saturday?.

Thanks,

Tags (1)
0 Karma

jkat54
SplunkTrust
SplunkTrust

You need two saved searches. One runs every 5 minutes Sunday - Friday, the other excludes those hours on Saturday

 */5 * * * 0-4,6

 */5 0-15,16-23 * * 5

Technically the second will run at 3:00pm and 4:00pm but not in between. Please let me know if hat is acceptable.

Credit to somisoni though, if you do this

*/5 0-14,16-23 * * 5

It won't run at 3pm but would run at 255pm and would also run at 4pm. So a great answer but leads us back to if you want it to run at 3pm and 4pm exactly or do you want it to stop at 255p and then resume at 4:05p?

Technically it can never run at 4pm exact because the scheduler isn't that precise. Sometimes it's off by a minute or two and also it takes time for the search to complete so I am going to go with what somisoni said as my final answer.

 Saturday Seach Cron:
 */5 0-14,16-23 * * 5

 Sunday through Friday Search Cron:
 */5 * * * 0-4,6
0 Karma

somesoni2
Revered Legend

Shouldn't */5 0-14,15-23 * * 5 be */5 0-14,16-23 * * 5?

jkat54
SplunkTrust
SplunkTrust

I was off but corrected, not with your exact answer. Thanks for mentioning it!

0 Karma

mattymo
Splunk Employee
Splunk Employee

I don't believe you will be able to achieve this with a single cron schedule. Is this for a Splunk alert or just a search? Can you tell us more about what you are trying to achieve? May be easier to use SPL to filter the results between 3-4 on Saturday.

side note: https://crontab.guru << awesome site

- MattyMo
0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...