We want an alert to run every day (Monday-Sunday) on a 30 minutes interval with one exception. The exception is it should not run specifically on Wednesday and Friday from 5AM to 8AM. However it should run on other hours on Wednesday and Friday as well (apart from 5AM to 8AM)
One cron is not able to achieve that. Hence want to change in the alert logic.
@rzv424
Solution1:
You can create two alerts with the same logic with different CRONs.
Solution2:
You can create one alert with a CRON to run every day of the week at 30 minutes interval, Cron is */30 * * * *
And you can add the filtering at the logic of query itself:
Use an EVAL command to output the current day and hour after your logic ends. and then filter or don't show your outputs as per your exception requirement
......| eval now_day=strftime(now(), "%a"), now_hour=strftime(now(), "%H")
| search NOT ((now_day="Wed" AND (now_hour="5" OR now_hour="6" OR now_hour="7" OR now_hour="8")) OR (now_day="Fri" AND (now_hour="5" OR now_hour="6" OR now_hour="7" OR now_hour="8")))
@rzv424
Solution1:
You can create two alerts with the same logic with different CRONs.
Solution2:
You can create one alert with a CRON to run every day of the week at 30 minutes interval, Cron is */30 * * * *
And you can add the filtering at the logic of query itself:
Use an EVAL command to output the current day and hour after your logic ends. and then filter or don't show your outputs as per your exception requirement
......| eval now_day=strftime(now(), "%a"), now_hour=strftime(now(), "%H")
| search NOT ((now_day="Wed" AND (now_hour="5" OR now_hour="6" OR now_hour="7" OR now_hour="8")) OR (now_day="Fri" AND (now_hour="5" OR now_hour="6" OR now_hour="7" OR now_hour="8")))
You have two options: