Alerting

how to create an alert for each working day before 8.00 AM. (tue- fri) summary from the past 24hr and Mon(3 days)?

gemrose
Explorer

Hello Team,

I need to send an alert on all working day at 8.00 AM with a time range of 24hrs except on Monday with a time range of 3 days. Will this be possible in our alert settings for the same SPL query but different time range. OR should we add in SPL query ?

 

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You could append a timeframe adjustment to your base search

<your base search> [| makeresults
| fields - _time
| addinfo
| eval day=strftime(info_max_time, "%w")
| eval period=if(day == 1, "-3d", "-1d")
| eval earliest=relative_time(info_max_time,period)
| eval latest=info_max_time
| fields earliest latest]

Here I have used the end time as the reference point, but you could do similar with info_min_time

scelikok
SplunkTrust
SplunkTrust

Hi @gemrose,

You can setup two alerts with below cron settings and time ranges using the same SPL;

Mondays;
Cron -> 0 8 * * 1
TimeRange --> -3d

Other days;
Cron -> 0 8 * * 2-5 
TimeRange --> -24h

 

 

If this reply helps you an upvote and "Accept as Solution" is appreciated.
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...