<?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 How do you trigger an alert using stats count to return 0 when value is 0? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-trigger-an-alert-using-stats-count-to-return-0-when/m-p/397334#M115322</link>
    <description>&lt;P&gt;I have an alert that is not triggering because there are no events occurring for one of my search parameters.  I would like to trigger when there are less than 10 events for "OtherChannelWithNoEvents", but when there are no events, no results are found for it and it is not triggered.  &lt;/P&gt;

&lt;P&gt;Here is the search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="databasesourcetype" 
|  eval Channel = case(ChannelCD == 3, "CSR", ChannelCD == 58 AND PartnerChannelDescriptor = "COR", "OtherChannelWithNoEvents")
| stats count by Channel
| search (Channel = OtherChannelWithNoEvents count &amp;lt;10)
OR (Channel = CSR count &amp;lt;200)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 25 Feb 2019 20:22:43 GMT</pubDate>
    <dc:creator>markhvesta</dc:creator>
    <dc:date>2019-02-25T20:22:43Z</dc:date>
    <item>
      <title>How do you trigger an alert using stats count to return 0 when value is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-trigger-an-alert-using-stats-count-to-return-0-when/m-p/397334#M115322</link>
      <description>&lt;P&gt;I have an alert that is not triggering because there are no events occurring for one of my search parameters.  I would like to trigger when there are less than 10 events for "OtherChannelWithNoEvents", but when there are no events, no results are found for it and it is not triggered.  &lt;/P&gt;

&lt;P&gt;Here is the search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="databasesourcetype" 
|  eval Channel = case(ChannelCD == 3, "CSR", ChannelCD == 58 AND PartnerChannelDescriptor = "COR", "OtherChannelWithNoEvents")
| stats count by Channel
| search (Channel = OtherChannelWithNoEvents count &amp;lt;10)
OR (Channel = CSR count &amp;lt;200)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Feb 2019 20:22:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-trigger-an-alert-using-stats-count-to-return-0-when/m-p/397334#M115322</guid>
      <dc:creator>markhvesta</dc:creator>
      <dc:date>2019-02-25T20:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do you trigger an alert using stats count to return 0 when value is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-trigger-an-alert-using-stats-count-to-return-0-when/m-p/397335#M115323</link>
      <description>&lt;P&gt;What's your trigger condition? Do you also want to trigger alert when your base search doesn't have any results?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 20:48:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-trigger-an-alert-using-stats-count-to-return-0-when/m-p/397335#M115323</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-02-25T20:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do you trigger an alert using stats count to return 0 when value is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-trigger-an-alert-using-stats-count-to-return-0-when/m-p/397336#M115324</link>
      <description>&lt;P&gt;Trigger is count &amp;gt; 1 and Yes.&lt;BR /&gt;&lt;BR /&gt;
It is a low volume alert, so when Either of those two channels is lower than a certain threshold, even 0 it should trigger an alert.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 21:08:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-trigger-an-alert-using-stats-count-to-return-0-when/m-p/397336#M115324</guid>
      <dc:creator>markhvesta</dc:creator>
      <dc:date>2019-02-25T21:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do you trigger an alert using stats count to return 0 when value is 0?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-trigger-an-alert-using-stats-count-to-return-0-when/m-p/397337#M115325</link>
      <description>&lt;P&gt;Keep the same trigger condition and try this version of search (the appendpipe will add a rows when there is no data from stats. We use that row in your filter)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype="databasesourcetype" 
 |  eval Channel = case(ChannelCD == 3, "CSR", ChannelCD == 58 AND PartnerChannelDescriptor = "COR", "OtherChannelWithNoEvents")
 | stats count by Channel
 | appendpipe [| stats count | where count=0 | eval Channel="No_Records"]
 | search (Channel = OtherChannelWithNoEvents count &amp;lt;10)
 OR (Channel = CSR count &amp;lt;200) OR (Channel="No_Records")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Feb 2019 21:12:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-trigger-an-alert-using-stats-count-to-return-0-when/m-p/397337#M115325</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-02-25T21:12:24Z</dc:date>
    </item>
  </channel>
</rss>

