Alerting

How to setup a Splunk alert to run on 2 different days during 2 different times?

rahulbhatia
Path Finder

Hi All,

 

I have a requirement where i want to setup the alert to run every 10 min on friday between 8-10pm and every 10 min on sunday between 6-8am.

 

i tried writing the Cron for it however it didnt work 

 

Can you please help

Labels (3)
0 Karma

rahulbhatia
Path Finder

15 20-22,6-8 * * 5,0 this is Cron schedule we have used but it is running during the same time on Friday and Sunday 

 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Which is to be expected with the given cron schedule.  Running at different times on certain days requires multiple cron schedules.  Since Splunk supports a single cron schedule for an alert, you need a separate alert for each cron schedule.  Or, as suggested by @JacekF , you can add intelligence to the alert.

---
If this reply helps you, Karma would be appreciated.
0 Karma

JacekF
Path Finder

I don't think this can be done with a cron schedule only. You can use a cron similar to that one:

*/10 20-22,6-8 * * 5,0

This should execute the alert at every 10th minute past every hour from 20 through 22 and every hour from 6 through 8 on Friday and Sunday. In the SPL you can add a condition to check the day of week and the hour and return results depending on day/hour combination.

Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

It would help to know the cron schedule(s) you tried, but I think you'll need two alerts to accomplish that.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...