Alerting

How to setup Splunk Alert between given times

thomashigginson
Path Finder

I kept cycling through the options for the Alert, and I couldn't figure out a way that allows me to setup an alert to run realtime but only start between the hours 7:00PM-6:00AM?

Tags (2)
1 Solution

s2_splunk
Splunk Employee
Splunk Employee

Alerts are results of scheduled searches and those are subject to the defined cron schedule. Your cron schedule would look something like this:

*/5 19,20,21,22,23,24,01,02,03,04,06 * * *

to run the search every five minutes between the hours of 7pm and 6am.
You shall not use a real-time search, because real-time searches don't end. Pick as large of an interval as you can afford. 5 Minutes is generous for most use cases I have come across. Real-time is overrated... 😉

View solution in original post

s2_splunk
Splunk Employee
Splunk Employee

Alerts are results of scheduled searches and those are subject to the defined cron schedule. Your cron schedule would look something like this:

*/5 19,20,21,22,23,24,01,02,03,04,06 * * *

to run the search every five minutes between the hours of 7pm and 6am.
You shall not use a real-time search, because real-time searches don't end. Pick as large of an interval as you can afford. 5 Minutes is generous for most use cases I have come across. Real-time is overrated... 😉

s2_splunk
Splunk Employee
Splunk Employee

Try */5 19-24,1-6 * * *

It appears that ranges have to be ascending, i.e. 19-6 doesn't work, but the above does.

0 Karma

thomashigginson
Path Finder

*/5 19,20,21,22,23,24,01,02,03,04,05,06 * * *
is giving me an invalid cron, and I checked the format multiple times. I also tried */5 19-06 * * * and it still didn't work. I keep getting invalid cron. Any ideas?

0 Karma

ppablo
Retired

For more information @thomashigginson on scheduled alerts and defining cron schedules, refer to the following documentation: http://docs.splunk.com/Documentation/Splunk/latest/Alert/Definescheduledalerts#Schedule_the_alert 🙂

0 Karma
Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...