Splunk Search

Cron schedule

Ash1
Communicator

We have an alert where the cron schedule runs for every 6hours

0 */6 * * *

but I don’t want to receive the alert at 6pm only how can I write a corn for that???

Labels (1)
0 Karma
1 Solution

Ash1
Communicator

Hi @richgalloway , thank you for that.

i have one more question, can u pls help on this

I want a cron where alert should trigger  4 times a day starting from 12am, 6am, 12pm, 6 pm and weekday only at 6am everyday

View solution in original post

0 Karma

Ash1
Communicator

Thank you all

0 Karma

richgalloway
SplunkTrust
SplunkTrust

If your problem is resolved, then please click the "Accept as Solution" button to help future readers.

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

richgalloway
SplunkTrust
SplunkTrust

You can specify the exact hours you want the alert to run.

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

Ash1
Communicator

Hi @richgalloway , thank you for that.

i have one more question, can u pls help on this

I want a cron where alert should trigger  4 times a day starting from 12am, 6am, 12pm, 6 pm and weekday only at 6am everyday

0 Karma

marnall
Builder

As richgalloway said, you need 2 separate alerts for 2 separate cron schedules. To make this maintainable, you could make a single Saved Search, then make 2 separate alerts that reference the single Saved Search using the | savedsearch  (https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Savedsearch

Each alert will have a cron schedule:

1) 4 times a day starting from 12am, 6am, 12pm, 6 pm (weekends - Sat and Sun)

0 */6 * * 0,6

2) only at 6AM on weekdays (Mon-Fri)

0 6 * * 1-5

For formulating cron schedules, I recommend using the website https://crontab.guru/ as it makes a human-readable schedule at the top.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

To have different cron schedules you have to clone the alert and set a separate schedule for each copy.

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

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 ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...