<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Excluding holidays and weekends for Alert and  alert if there is 0 events in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744596#M241283</link>
    <description>&lt;P&gt;My search query:&lt;BR /&gt;&lt;BR /&gt;Index=xxx &amp;lt;xxxxxxx&amp;gt;&lt;BR /&gt;|eval Date=strftime(_time,"%Y-%m-%d")&lt;BR /&gt;| lookup holidays.csv HolidayDate as Date output HolidayDate&lt;BR /&gt;| eval should_alert=if((isnull(HolidayDate)), "Yes", "No")&lt;BR /&gt;| table Date should_alert&lt;BR /&gt;| where should_alert="Yes"&lt;BR /&gt;&lt;BR /&gt;So I've been trying to create an complicated alert.&lt;BR /&gt;unfortunately it failed, and is looking for guidance.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The Alert is setup is&amp;nbsp;supposed to fire if there are no results OR more than 1&lt;BR /&gt;unless it's the day after a weekend or holiday, in which case, this is&lt;BR /&gt;&lt;BR /&gt;to achieve the alert to look for 0 results OR&amp;nbsp; anything other than 1&lt;BR /&gt;I've added below the following:&lt;BR /&gt;&lt;BR /&gt;Trigger conditions:&lt;BR /&gt;Number of results&lt;BR /&gt;is not equal to 1&lt;/P&gt;&lt;P&gt;so when a date appears on the Muted date(holiday.csv) I want.&lt;BR /&gt;turns out it had 0 events that day.&lt;BR /&gt;and the 0 events/results triggered the alert and fired on Easter date.&lt;BR /&gt;&lt;BR /&gt;Also when we Mute a dates does it make it return 0 events?&lt;BR /&gt;so technically it will still fire on the dates due to my trigger condition, how can we make sure it mutes on the holiday.csv lookup file , and yet alert on 0 events that are not on the holiday.csv&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 21 Apr 2025 20:08:00 GMT</pubDate>
    <dc:creator>Cheng2Ready</dc:creator>
    <dc:date>2025-04-21T20:08:00Z</dc:date>
    <item>
      <title>Excluding holidays and weekends for Alert and  alert if there is 0 events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744596#M241283</link>
      <description>&lt;P&gt;My search query:&lt;BR /&gt;&lt;BR /&gt;Index=xxx &amp;lt;xxxxxxx&amp;gt;&lt;BR /&gt;|eval Date=strftime(_time,"%Y-%m-%d")&lt;BR /&gt;| lookup holidays.csv HolidayDate as Date output HolidayDate&lt;BR /&gt;| eval should_alert=if((isnull(HolidayDate)), "Yes", "No")&lt;BR /&gt;| table Date should_alert&lt;BR /&gt;| where should_alert="Yes"&lt;BR /&gt;&lt;BR /&gt;So I've been trying to create an complicated alert.&lt;BR /&gt;unfortunately it failed, and is looking for guidance.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The Alert is setup is&amp;nbsp;supposed to fire if there are no results OR more than 1&lt;BR /&gt;unless it's the day after a weekend or holiday, in which case, this is&lt;BR /&gt;&lt;BR /&gt;to achieve the alert to look for 0 results OR&amp;nbsp; anything other than 1&lt;BR /&gt;I've added below the following:&lt;BR /&gt;&lt;BR /&gt;Trigger conditions:&lt;BR /&gt;Number of results&lt;BR /&gt;is not equal to 1&lt;/P&gt;&lt;P&gt;so when a date appears on the Muted date(holiday.csv) I want.&lt;BR /&gt;turns out it had 0 events that day.&lt;BR /&gt;and the 0 events/results triggered the alert and fired on Easter date.&lt;BR /&gt;&lt;BR /&gt;Also when we Mute a dates does it make it return 0 events?&lt;BR /&gt;so technically it will still fire on the dates due to my trigger condition, how can we make sure it mutes on the holiday.csv lookup file , and yet alert on 0 events that are not on the holiday.csv&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2025 20:08:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744596#M241283</guid>
      <dc:creator>Cheng2Ready</dc:creator>
      <dc:date>2025-04-21T20:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert and  alert if there is 0 events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744603#M241285</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/256484"&gt;@Cheng2Ready&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its hard to write this without seeing the full search but having an alert fire when its !=1 is very limiting, however you might make it work with something like this below.&lt;/P&gt;&lt;P&gt;If there are no results found then you will struggle - so you might need to append an empty |makeresults to ensure that you have atleast 1 event, then you can count the events and check the date:&lt;/P&gt;&lt;PRE&gt;index=xxx earliest=@d latest=now&lt;BR /&gt;| append [|makeresults]&lt;BR /&gt;|&amp;nbsp;stats&amp;nbsp;count&amp;nbsp;as&amp;nbsp;event_count&lt;BR /&gt;| eval Date=strftime(now(),"%Y-%m-%d") | lookup holidays.csv HolidayDate AS Date OUTPUT HolidayDate | eval wd=strftime(now(),"%w") | eval isWeekend=if(wd=="0" OR wd=="6",1,0)&lt;BR /&gt;| where isWeekend=0 AND isnull(HolidayDate) AND event_count!=2&lt;/PRE&gt;&lt;P&gt;This will return a single event IF its not a weekend/holiday AND the event_count is 2 - Note this is 2 because we're appending a fake result inase there are zero events returned. If zero are returned then it will still append and result in event_count=1 which will then still fire your alert.&lt;/P&gt;&lt;P&gt;You will need to adjust your search to fire when number of results &amp;gt;0 (or !=0)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does that make sense?&lt;/P&gt;&lt;DIV&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt; &lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt; If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 21 Apr 2025 21:31:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744603#M241285</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-04-21T21:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert and  alert if there is 0 events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744642#M241290</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/256484"&gt;@Cheng2Ready&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;if you have a lookup containing all the holidays, it's easier to use it as subsearch in the main search, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=xxx &amp;lt;xxxxxxx&amp;gt; NOT (date_wday="saturday" OR date_wday="sunday")
 OR [ | inputlookup holidays.csv | eval date_year=strftime(HolidayDate,"%Y"), date_month=strftime(HolidayDate,"%m"), date_mday=strftime(HolidayDate,"%d") | fields date_year date_month date_mday ]&lt;/LI-CODE&gt;&lt;P&gt;if you want, in the same way, you could also add a rule for the out of office time (e.g. 18-9).&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 07:14:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744642#M241290</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2025-04-22T07:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert and  alert if there is 0 events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744809#M241321</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp; in my search query i thought it showed that I have a lookup containing all the holidays that I wanted to have mute.&lt;BR /&gt;so yes I do have it.&lt;BR /&gt;just wanted to question this line&lt;BR /&gt;&lt;BR /&gt;NOT (dat_wday="saturday" OR date_wday="sunday")&lt;/P&gt;&lt;P&gt;why sat and sunday?&lt;BR /&gt;I have my cron schedule to search&amp;nbsp;&lt;BR /&gt;0 6 * * 1-5&amp;nbsp; so its monday-friday&lt;BR /&gt;&lt;BR /&gt;so that should cover it?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;could I just&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Index=xxx &amp;lt;xxxxxxx&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;|eval Date=strftime(_time,"%Y-%m-%d")&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NOT [| lookup holidays.csv HolidayDate as Date output HolidayDate]&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| eval should_alert=if((isnull(HolidayDate)), "Yes", "No")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| table Date should_alert&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| where should_alert="Yes&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 17:52:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744809#M241321</guid>
      <dc:creator>Cheng2Ready</dc:creator>
      <dc:date>2025-04-23T17:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert and  alert if there is 0 events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744812#M241324</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/170906"&gt;@livehybrid&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thank you for the response&amp;nbsp;&lt;BR /&gt;yeah I'm still trying to understand its seems like a lot&lt;BR /&gt;&lt;BR /&gt;despite my description of the issue&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;my run on cron schedule is setup to this&lt;BR /&gt;&lt;BR /&gt;0 6 * * 2-6&lt;BR /&gt;&lt;BR /&gt;tues~saturday.&lt;BR /&gt;where Monday and Sunday is excluded to run the search.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 18:06:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744812#M241324</guid>
      <dc:creator>Cheng2Ready</dc:creator>
      <dc:date>2025-04-23T18:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert and  alert if there is 0 events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744814#M241325</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;Will this fix the issue where it returns "no results"?&amp;nbsp;&lt;BR /&gt;my alert would still fire due to this condition&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cheng2Ready_0-1745431710760.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/38717i30F2313994353868/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cheng2Ready_0-1745431710760.png" alt="Cheng2Ready_0-1745431710760.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 18:08:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744814#M241325</guid>
      <dc:creator>Cheng2Ready</dc:creator>
      <dc:date>2025-04-23T18:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert and  alert if there is 0 events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744851#M241328</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/256484"&gt;@Cheng2Ready&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;ok, it's a differenty solution and it's ok.&lt;/P&gt;&lt;P&gt;about your search, you have to decide if you want to use the lookup command (as your original solution) or a subsearch using NOT [...], as my solution, but not the last solution that you shared.&lt;/P&gt;&lt;P&gt;I prefer my solution because it's a best practice to move all the possible search conditions in the main search.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Apr 2025 06:42:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744851#M241328</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2025-04-24T06:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert and  alert if there is 0 events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744952#M241347</link>
      <description>&lt;P&gt;Quick question&amp;nbsp;&lt;BR /&gt;so lets say we use your query.&lt;BR /&gt;When muted on the day of lets say 4/25 and there was an event that happened that day&lt;BR /&gt;does the alert the say:&lt;BR /&gt;there no results that return therefore it will not fire the alert.&lt;BR /&gt;&lt;BR /&gt;I am trying to figure why my alert fired on of the the dates that my lookup table has chose to mute.&lt;BR /&gt;this is my alert settings&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;cron schedule to search&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;0 6 * * 1-5&amp;nbsp; so its monday-friday&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cheng2Ready_1-1745530053018.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/38736iCF7508639D1F6D4A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cheng2Ready_1-1745530053018.png" alt="Cheng2Ready_1-1745530053018.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;but yet the alert fired on a day that it was suppose to mute.&lt;BR /&gt;I was wondering could the trigger condition be the root cause?&lt;BR /&gt;since there was no results returned and so the trigger alert came to a conclusion no results is also != 1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Apr 2025 21:28:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744952#M241347</guid>
      <dc:creator>Cheng2Ready</dc:creator>
      <dc:date>2025-04-24T21:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert and  alert if there is 0 events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744980#M241349</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/256484"&gt;@Cheng2Ready&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;you run your alert Monday-Friday, and you filter your results using the above search in this way you will not have results in those days so the alert will not fire.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2025 06:03:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/744980#M241349</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2025-04-25T06:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert and  alert if there is 0 events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/745283#M241396</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;appreciate the feedback.&lt;BR /&gt;I'm just having trouble understanding why my alert fired when it was not suppose to.&lt;BR /&gt;I do not know where to start troubleshooting, but I will accept your answer to the original question&lt;/P&gt;</description>
      <pubDate>Wed, 30 Apr 2025 19:58:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/745283#M241396</guid>
      <dc:creator>Cheng2Ready</dc:creator>
      <dc:date>2025-04-30T19:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert and  alert if there is 0 events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/745293#M241401</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/256484"&gt;@Cheng2Ready&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;if you need help, open a new post so more people in Community will be able to help you.&lt;/P&gt;&lt;P&gt;Anyway, start checking what's the condition that fails: if the lookup or the weekday, and then check if it fails every time or some times, and if sometimes, when,&lt;/P&gt;&lt;P&gt;As secondary test, check if it's a border condition: e.g. if the event has timestamp at 23:59:59 or 00:00:00.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 05:52:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert-and-alert-if-there-is/m-p/745293#M241401</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2025-05-01T05:52:59Z</dc:date>
    </item>
  </channel>
</rss>

