<?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 Re: Excluding holidays and weekends for Alert in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/711632#M240209</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; I will take look&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Feb 2025 17:21:48 GMT</pubDate>
    <dc:creator>Cheng2Ready</dc:creator>
    <dc:date>2025-02-14T17:21:48Z</dc:date>
    <item>
      <title>Excluding holidays and weekends for Alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/711548#M240199</link>
      <description>&lt;P&gt;I have a Holiday.csv file that imports dates for specific holiday dates.&lt;BR /&gt;example:&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2024-04-01&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2026-12-29&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2028-06-26&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;I am working on muting alerts during a day after the dates.&lt;BR /&gt;&lt;BR /&gt;So, if the holiday was on Monday, it shouldn't fire on Tuesday, if the holiday was on Tuesday, it shouldn't fire on Weds, etc.&lt;BR /&gt;The weird one is if the holiday is on a Friday, then we actually don't want the alert to fire on Monday&lt;BR /&gt;&lt;BR /&gt;this is what I have for my query.&amp;nbsp; just not sure how I would add in the Friday scenario if I did&amp;nbsp;&lt;BR /&gt;&amp;nbsp;strftime(_time+86400,"%Y-%m-%d")&amp;nbsp; ```to add one day```&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;index=&amp;lt;search&amp;gt;&lt;BR /&gt;| eval Date=strftime(_time,"%Y-%m-%d")&lt;BR /&gt;| lookup holidays.csv HolidayDate as Date output Holiday&lt;BR /&gt;| eval should_alert=if((holidays.csv!="" AND isnull(Holiday)), "Yes", "No")&lt;BR /&gt;| table Date should_alert&lt;BR /&gt;| where should_alert="Yes"&lt;BR /&gt;&lt;BR /&gt;If something like this is possible in Splunk, I think it would work: if holiday is a Friday, add 3 days, otherwise add 1 day&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2025 21:20:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/711548#M240199</guid>
      <dc:creator>Cheng2Ready</dc:creator>
      <dc:date>2025-02-13T21:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/711549#M240200</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;To implement the desired behavior for muting alerts following holidays based on your holiday dates, you can modify your Splunk query to handle the special case where the holiday falls on a Friday. Here's a revised version of your query that checks for Friday holidays and adjusts the day to mute alerts:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=&amp;lt;search&amp;gt;
| eval Date=strftime(_time, "%Y-%m-%d")
| lookup holidays.csv HolidayDate as Date output Holiday
| eval should_alert = if(isnull(Holiday), "Yes", "No")
| eval day_of_week = strftime(_time, "%A") // Get the day of the week
| eval mute_date = if(day_of_week == "Friday", Date + 3*86400, Date + 86400)
// Mute for Friday holidays
| eval mute_alert = if(mute_date == Date, "No", should_alert) // Adjust mute
based on the calculated mute date
| table Date mute_alert
| where mute_alert = "Yes"&lt;/LI-CODE&gt;&lt;H3&gt;Explanation:&lt;/H3&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Day of the Week Calculation&lt;/STRONG&gt;: `strftime(_time, "%A")` retrieves the day of&lt;BR /&gt;the week for the given date.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Mute Date Calculation&lt;/STRONG&gt;: The line:&lt;BR /&gt;`eval mute_date = if(day_of_week == "Friday", Date + 3*86400, Date +&lt;BR /&gt;86400)` determines the mute date based on whether the holiday is on a Friday or&lt;BR /&gt;another day. If it's Friday, it adds 3 days (including the weekend) to the mute&lt;BR /&gt;date; otherwise, it adds only 1 day.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Mute Alerts Logic&lt;/STRONG&gt;: We then check if the current date matches the&lt;BR /&gt;`mute_date`, setting `mute_alert` accordingly.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Final Filtering&lt;/STRONG&gt;: The `where` clause filters results to only keep entries&lt;BR /&gt;where alerts should still fire, aligning with your requirements.&lt;BR /&gt;This should successfully mute alerts on the day following any holiday based on&lt;BR /&gt;the criteria you've established.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Please let me know how you get on and consider accepting this answer or adding karma this answer if it has helped.&lt;BR /&gt;Regards&lt;/P&gt;&lt;P&gt;Will&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2025 21:26:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/711549#M240200</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-02-13T21:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/711570#M240201</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;please, see this my old answer:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.splunk.com/t5/Splunk-Search/Bank-holiday-exclusion-from-search-query/m-p/491071" target="_blank"&gt;https://community.splunk.com/t5/Splunk-Search/Bank-holiday-exclusion-from-search-query/m-p/491071&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2025 07:15:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/711570#M240201</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2025-02-14T07:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/711631#M240208</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/170906"&gt;@livehybrid&lt;/a&gt;&amp;nbsp;livehybrid I will give this try today and let you know the results&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2025 17:21:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/711631#M240208</guid>
      <dc:creator>Cheng2Ready</dc:creator>
      <dc:date>2025-02-14T17:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/711632#M240209</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; I will take look&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2025 17:21:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/711632#M240209</guid>
      <dc:creator>Cheng2Ready</dc:creator>
      <dc:date>2025-02-14T17:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/711955#M240268</link>
      <description>&lt;P&gt;Good Morning&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/170906"&gt;@livehybrid&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Just wanted to wrap my head around the logic&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;2025-02-13&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2025-02-14&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2025-02-15&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;So is the yes mean that it will alert on those dates? hence returning an result?&lt;BR /&gt;Also lets say for example&lt;BR /&gt;If an alert fired on the 15th and the lookuptable has the date 2025-02-15&lt;BR /&gt;Does it mute the next day? so the 16th ?wont get alerted? (if it falls within mon~thursday)&lt;BR /&gt;where Friday it will jump to monday to mute&lt;BR /&gt;so it would look like this&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;2025-02-15&lt;/TD&gt;&lt;TD&gt;no&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;and&amp;nbsp; instead of displaying that in a event it will not actually return any results?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If I want to only add 1 day would I change it like this?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval mute_date = if(day_of_week == Date + 86400)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;all the best!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2025 22:22:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/711955#M240268</guid>
      <dc:creator>Cheng2Ready</dc:creator>
      <dc:date>2025-02-18T22:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/712156#M240299</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;&lt;BR /&gt;Thank you&amp;nbsp;&lt;BR /&gt;I looked at your post as saw&lt;/P&gt;&lt;PRE&gt;your_search
| eval date=strftime(_time,"%Y-%m-%d")
| search NOT [ inputlookup holidays.csv | fields date ]
| ...&lt;/PRE&gt;&lt;P&gt;in this way you exclude all the events in the days contained in the lookup.&lt;BR /&gt;&lt;BR /&gt;So now the question is&amp;nbsp;&lt;BR /&gt;I am using this lookup file to say&amp;nbsp;&lt;BR /&gt;Do not alert on these dates in the lookup&lt;BR /&gt;but we need to +1 day on them&lt;BR /&gt;&lt;BR /&gt;so lets say the lookup table is&amp;nbsp;&lt;BR /&gt;&amp;nbsp;2025-02-17th&lt;BR /&gt;We would need to add 1 day to it so now its actually Muting on the 18th&lt;BR /&gt;if that make sense?&lt;BR /&gt;&lt;BR /&gt;to simplify, the lookup table Dates we just need to +1 day&amp;nbsp; to it and make sure on those dates, we just mute alert&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;would it look like this?&lt;BR /&gt;your_search | eval date=strftime(_time + 86400,"%Y-%m-%d")&lt;BR /&gt;| search NOT [ inputlookup holidays.csv | fields date ]&lt;BR /&gt;|...&lt;BR /&gt;&lt;BR /&gt;Also is there a difference using from inputlookup vs lookup?&lt;BR /&gt;&lt;BR /&gt;All the best!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2025 23:24:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/712156#M240299</guid>
      <dc:creator>Cheng2Ready</dc:creator>
      <dc:date>2025-02-20T23:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/712178#M240303</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 to exclude only the days following holidays, you approach is correct.&lt;/P&gt;&lt;P&gt;if instead you need to exclude both the holidays and the one followind days, you have to implement a mix between the two solutions with both the checks.&lt;/P&gt;&lt;P&gt;let us know if we can help you more, or, please, accept one answer for the other people of Community.&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 06:48:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/712178#M240303</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2025-02-21T06:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/712246#M240312</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;&lt;BR /&gt;I see&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;As for you comment&lt;BR /&gt;"&lt;SPAN&gt;if instead you need to exclude both the holidays and the one following days, you have to implement a mix between the two solutions&amp;nbsp;"&lt;BR /&gt;its a no. its more simply than that.&lt;BR /&gt;&lt;BR /&gt;Just need to add one following day to the lookuptable date. for Muting&lt;BR /&gt;&lt;BR /&gt;Tried my query but doesn't seem like the results are correct.&lt;BR /&gt;&lt;BR /&gt;or how would you go about it?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 17:19:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/712246#M240312</guid>
      <dc:creator>Cheng2Ready</dc:creator>
      <dc:date>2025-02-21T17:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/712286#M240317</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 wave two ways:&lt;/P&gt;&lt;P&gt;insert al the dates to excude in the lookup, in this case you can use the above search;&lt;/P&gt;&lt;P&gt;insert in the lookup only the holydays and run something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;your_search
| eval date=strftime(_time,"%Y-%m-%d")
| search NOT ( [ | inputlookup holidays.csv | fields date ] OR [ | inputlookup holidays.csv | eval date=strftime(strptime(date,"%Y-%m-%d")+86400)) | fields date ]
| ...&lt;/LI-CODE&gt;&lt;P&gt;obviously in the lookup there must be a column called "date" and the format of the values must be "yyyy-mm-dd".&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 22 Feb 2025 06:38:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/712286#M240317</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2025-02-22T06:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/712644#M240380</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;&lt;BR /&gt;im getting a Error&lt;BR /&gt;&lt;SPAN&gt;Error in 'EvalCommand': The arguments to the 'strftime' function are invalid.&lt;BR /&gt;&lt;BR /&gt;My search&lt;BR /&gt;| eval Date=strftime(_time, "%Y-%m-%d")&lt;BR /&gt;| search NOT ( [ | inputlookup holidays.csv | eval HolidayDate=strftime(strptime(HolidayDate,"%Y-%m-%d")+86400)) | fields HolidayDate ]&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2025 20:53:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/712644#M240380</guid>
      <dc:creator>Cheng2Ready</dc:creator>
      <dc:date>2025-02-26T20:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding holidays and weekends for Alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/712650#M240381</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Date=strftime(_time, "%Y-%m-%d")
| search NOT ( [ | inputlookup holidays.csv | eval HolidayDate=strftime(strptime(HolidayDate,"%Y-%m-%d")+86400,"%Y-%m-%d") | fields HolidayDate ])&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 26 Feb 2025 22:20:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excluding-holidays-and-weekends-for-Alert/m-p/712650#M240381</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2025-02-26T22:20:56Z</dc:date>
    </item>
  </channel>
</rss>

