Alerting

How to setup cron to run in nighttime from 23:00 today to 6:00 tomorow at 8:00

phamxuantung
Communicator

I have an alert that I want to run between 23:00PM to 6:00AM, during that time, run the search "Last 24 hours", and email the result at 8:00 everyday. I have yet to found a way to trigger this.

Labels (2)
0 Karma
1 Solution

venkatasri
SplunkTrust
SplunkTrust

This one is right - The night one will run and print all the result in a csv (alert1) and (alert2) will run and email the result at 8:00 everyday.

Every hour cron during day time could be a new alert altogether.. cron you are already setting to every 60 mins 6-23. Last 24 hours is your timerange to search through that's not a cron.

View solution in original post

0 Karma

venkatasri
SplunkTrust
SplunkTrust

This one is right - The night one will run and print all the result in a csv (alert1) and (alert2) will run and email the result at 8:00 everyday.

Every hour cron during day time could be a new alert altogether.. cron you are already setting to every 60 mins 6-23. Last 24 hours is your timerange to search through that's not a cron.

0 Karma

venkatasri
SplunkTrust
SplunkTrust

Hi @phamxuantung 

IF you schedule an alert between 11 PM and 6 AM to run you can not differ the email to sent out at 08 AM.

Instead you could schedule the alert at above said time write the results to a summary index or lookup. At 08 AM you should schedule one more alert for Email Action alone looking into results either summary index or lookup file.

You will end up having 2 scheduled searches.

0 Karma

phamxuantung
Communicator

I want 2 alerts, one run at work hours and one run at night. The day one can i set the cron to "Last 24 hours"

 

*/60 6-23 *  * *

 

meaning every hour from 6:00 to 23:00 as 1 alert.

The night one will run and print all the result in a csv (alert1) and (alert2) will run and email the result at 8:00 everyday. Am I understand your ideal right?
But I still don't know how to set cron from 23:00PM to 6:00AM

0 Karma
Get Updates on the Splunk Community!

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to Officially Supported Splunk ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI! Discover how Splunk’s agentic AI ...