Alerting

How do we configure a scheduled search to run every 15 minutes except between 3:30AM and 8:30AM?

vinayak909
New Member

Hello,

In one of our Splunk searches, we are triggering an alert when 'Number of Results' is equal to 'zero'. We have scheduled to run this search every 15 mins using Cron expression (i.e. */15 * * * *). Now, we want to set up a blackout period for this search between 3.30 AM to 8.30 AM.

Can we achieve this by embedding the 'date_hour' & 'date_minute' expression in the search as follows:

source="/cust/app/log/server.log" ShipmentRequest WarehouseId="1234" NOT ("desired text") NOT (date_hour=3 AND date_minute>=29 AND date_minute<=60) NOT (date_hour=4) NOT (date_hour=5) NOT (date_hour=6) NOT (date_hour=7) NOT (date_hour=8 AND date_minute>=0 AND date_minute>=30)

Thanks,
Vinayak

0 Karma

hortonew
Builder

Try something like this?

index=* NOT (earliest=@d+3h+30m latest=@d+8h+30m)

Edit: I'm pretty sure you need to be looking for >0 results for something like what you want to work. If you're already looking for 0 results, a blackout period in the search itself won't do the trick because the filtering won't produce any results.

0 Karma

Raghav2384
Motivator

I had a same use case with slight difference

We didn't want any alarms between 3Am and 6AM

Here's the cron: 30 0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 * * *

That worked for me.

Thanks,
Raghav

0 Karma

vinayak909
New Member

Thanks Raghav. But since my requirement includes odd hour interval (i.e. 3.30 & 8.30), your cron expression is not serving my purpose.

I am looking for something which can be embedded in the query itself.

Thanks,
Vinayak

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...