Alerting

How to Write Cron expression to Schedule alert on @ 11am, Every month on 2nd Wednesday,Thursday,Friday?

ajayabburi508
Path Finder

Hi Splunkers,

We need to schedule alert for Every month on 2nd Wednesday,Thursday and Friday on @11 am. I have tried with below Cron Expression but i didn't get exact results.

Cron Expression: 0 11 8-14 * 3-4

Please provide proper cron expression.

Labels (2)
0 Karma

PavelP
Motivator

Hello @ajayabburi508

if you specify both days of month and days of week, they are combined with an "OR"

Commands are executed by cron(8) when the 'minute', 'hour', and 'month of the year' fields match the current time, and at least one of the two 'day' fields ('day of month', or 'day of week') match the current time.

0 11 * * 3-5 “At 11:00 on every day-of-week from Wednesday through Friday.” https://crontab.guru/#0_11_*_*_3-5

0 11 8-14 * 3-5 “At 11:00 on every day-of-month from 8 through 14 and on every day-of-week from Wednesday through Friday.” https://crontab.guru/#0_11_8-14_*_3-5

So you can use the first version 0 11 * * 3-5 and discard 12-14 results/month or 0 11 8-14 * * and discard 4 results/month

0 Karma

ajayabburi508
Path Finder

This is not working can you provide exact expression which is working in crontab related to my question.

0 Karma

PavelP
Motivator

@ajayabburi508 it seems it is not possible with one single expression, both provided expressions are partial workarounds but not the solution that you asked

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...