<?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: How to blackout the alerts in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-to-blackout-the-alerts/m-p/292889#M5351</link>
    <description>&lt;P&gt;You could create a blackout macro and add it once to every alert search code.  &lt;/P&gt;

&lt;P&gt;woodcock has posted a version of the code in several places -- (search for blackout and cron together and you'll find a bunch of them__ here's a few links... &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://answers.splunk.com/answers/24824/can-i-set-a-blackout-period-for-a-scheduled-search-during-which-it-should-not-generate-alerts.html"&gt;https://answers.splunk.com/answers/24824/can-i-set-a-blackout-period-for-a-scheduled-search-during-which-it-should-not-generate-alerts.html&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://answers.splunk.com/answers/294186/how-to-create-a-splunk-alert-and-schedule-it-to-by.html"&gt;https://answers.splunk.com/answers/294186/how-to-create-a-splunk-alert-and-schedule-it-to-by.html&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;His version intentionally generates errors when the search runs during a blackout, but I modified it to a version that just quietly returns no results here...&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://answers.splunk.com/answers/261163/is-there-a-way-i-can-schedule-a-saved-search-to-ru.html#answer-260370"&gt;https://answers.splunk.com/answers/261163/is-there-a-way-i-can-schedule-a-saved-search-to-ru.html#answer-260370&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;The basic method for this silenced version is to add a subsearch that figures out whether you are running in a blackout window, and if so, adds a ridiculous search term that will never be found.  That makes it certain that there will be zero records returned, and it should be pretty quick in doing so. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; YOUR SEARCH HERE 
  [ | noop | stats count AS search 
    | eval search=if(((tonumber(strftime(now(),"%W"))%2)==1),"SomeLongStringHereWhichWillNeverBeFoundInBloomFilters","")] 
 | YOUR PROCESSING HERE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note the preceding example happened to be for a cron that ran once per week, but which really only wanted to run on alternate weeks.  Thus, week number odd/even test was the method of deciding blackouts.  Replace &lt;CODE&gt;((tonumber(strftime(now(),"%W"))%2)==1)&lt;/CODE&gt; with a test that returns &lt;CODE&gt;true()&lt;/CODE&gt; during your blackouts and &lt;CODE&gt;false()&lt;/CODE&gt; at all other times.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;You may need to develop a similar but inverse method for any alert which is designed to complain when there are zero records returned...such as for when a host stops reporting.  The format of that will depend on the typical architecture of your alerts.  If you need that, then please open a new question, post an example of your alert that you need to hush during blackouts, and the community will be able to help you with a version that does what you need.&lt;/P&gt;</description>
    <pubDate>Thu, 23 Mar 2017 20:09:52 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-03-23T20:09:52Z</dc:date>
    <item>
      <title>How to blackout the alerts</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-blackout-the-alerts/m-p/292888#M5350</link>
      <description>&lt;P&gt;Is there a way to blackout all the alerts in Splunk during the maintenance window all at one go  in Splunk Cloud&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 18:28:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-blackout-the-alerts/m-p/292888#M5350</guid>
      <dc:creator>srisplunk12</dc:creator>
      <dc:date>2017-03-23T18:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to blackout the alerts</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-blackout-the-alerts/m-p/292889#M5351</link>
      <description>&lt;P&gt;You could create a blackout macro and add it once to every alert search code.  &lt;/P&gt;

&lt;P&gt;woodcock has posted a version of the code in several places -- (search for blackout and cron together and you'll find a bunch of them__ here's a few links... &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://answers.splunk.com/answers/24824/can-i-set-a-blackout-period-for-a-scheduled-search-during-which-it-should-not-generate-alerts.html"&gt;https://answers.splunk.com/answers/24824/can-i-set-a-blackout-period-for-a-scheduled-search-during-which-it-should-not-generate-alerts.html&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://answers.splunk.com/answers/294186/how-to-create-a-splunk-alert-and-schedule-it-to-by.html"&gt;https://answers.splunk.com/answers/294186/how-to-create-a-splunk-alert-and-schedule-it-to-by.html&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;His version intentionally generates errors when the search runs during a blackout, but I modified it to a version that just quietly returns no results here...&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://answers.splunk.com/answers/261163/is-there-a-way-i-can-schedule-a-saved-search-to-ru.html#answer-260370"&gt;https://answers.splunk.com/answers/261163/is-there-a-way-i-can-schedule-a-saved-search-to-ru.html#answer-260370&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;The basic method for this silenced version is to add a subsearch that figures out whether you are running in a blackout window, and if so, adds a ridiculous search term that will never be found.  That makes it certain that there will be zero records returned, and it should be pretty quick in doing so. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; YOUR SEARCH HERE 
  [ | noop | stats count AS search 
    | eval search=if(((tonumber(strftime(now(),"%W"))%2)==1),"SomeLongStringHereWhichWillNeverBeFoundInBloomFilters","")] 
 | YOUR PROCESSING HERE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note the preceding example happened to be for a cron that ran once per week, but which really only wanted to run on alternate weeks.  Thus, week number odd/even test was the method of deciding blackouts.  Replace &lt;CODE&gt;((tonumber(strftime(now(),"%W"))%2)==1)&lt;/CODE&gt; with a test that returns &lt;CODE&gt;true()&lt;/CODE&gt; during your blackouts and &lt;CODE&gt;false()&lt;/CODE&gt; at all other times.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;You may need to develop a similar but inverse method for any alert which is designed to complain when there are zero records returned...such as for when a host stops reporting.  The format of that will depend on the typical architecture of your alerts.  If you need that, then please open a new question, post an example of your alert that you need to hush during blackouts, and the community will be able to help you with a version that does what you need.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 20:09:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-blackout-the-alerts/m-p/292889#M5351</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-03-23T20:09:52Z</dc:date>
    </item>
  </channel>
</rss>

