<?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 setting up alert for search on index when counts for parameter are 0 in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219713#M188060</link>
    <description>&lt;P&gt;I am able to set up alerts for an index when the count = 0 for a specific parameter value. Since I have over 50 over these values, it is cumbersome to create so many alerts and wondered if I can create one alert that is able to monitor across these values. Let me explain with example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/statsData.newIndex/tcp/10014" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is the general search for the main index but for the specific parameter value:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/statsData.newIndex/tcp/10014" PStream=864
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So I set up alerts for multiple values of this PStream field that monitors the count, and alerts when count =0 for the last hour. Is there a way to construct the search so that it monitors all values of this field PStream and for each one if the count =0, I will get the appropriate alert?&lt;/P&gt;</description>
    <pubDate>Thu, 05 Nov 2015 14:37:01 GMT</pubDate>
    <dc:creator>jdepp</dc:creator>
    <dc:date>2015-11-05T14:37:01Z</dc:date>
    <item>
      <title>setting up alert for search on index when counts for parameter are 0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219713#M188060</link>
      <description>&lt;P&gt;I am able to set up alerts for an index when the count = 0 for a specific parameter value. Since I have over 50 over these values, it is cumbersome to create so many alerts and wondered if I can create one alert that is able to monitor across these values. Let me explain with example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/statsData.newIndex/tcp/10014" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is the general search for the main index but for the specific parameter value:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/statsData.newIndex/tcp/10014" PStream=864
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So I set up alerts for multiple values of this PStream field that monitors the count, and alerts when count =0 for the last hour. Is there a way to construct the search so that it monitors all values of this field PStream and for each one if the count =0, I will get the appropriate alert?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 14:37:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219713#M188060</guid>
      <dc:creator>jdepp</dc:creator>
      <dc:date>2015-11-05T14:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: setting up alert for search on index when counts for parameter are 0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219714#M188061</link>
      <description>&lt;P&gt;How about this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/statsData.newIndex/tcp/10014" | stats count by PStream | where count=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This search should give you a result with a line for each value of PStream with zero count. If you create an alert on that, you could either go easy and contain the search result in that one email (so the recipient has to look at it to determine which PStream(s) are affected).&lt;/P&gt;

&lt;P&gt;Or, if you need to explicitly send an email for each PStream, you could create a lookup for the appropriate address for each PStream and use the &lt;CODE&gt;sendemail&lt;/CODE&gt; command with a &lt;CODE&gt;map&lt;/CODE&gt; command (docs &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.1/SearchReference/Sendemail"&gt;here&lt;/A&gt; and &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.1/SearchReference/Map"&gt;here&lt;/A&gt;). I have to admit I'm not sure about that second method, it appears that &lt;A href="https://answers.splunk.com/answers/77736/sendemail-question-iterating-through-results-to-perform-slightly-different-actions-based-on-output.html"&gt;it has been asked before&lt;/A&gt;, I only skimmed the answers though.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 15:01:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219714#M188061</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-11-05T15:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: setting up alert for search on index when counts for parameter are 0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219715#M188062</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... source="/statsData.newIndex/tcp/10014" | stats count(eval(PStream="864")) AS countPstream864 ... count(eval(otherField="otherValue")) AS countOtherValue | transpose| rename "row 1" AS count | where count=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then setup alert for &lt;CODE&gt;Number of Events &amp;gt; 0&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 15:01:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219715#M188062</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-11-05T15:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: setting up alert for search on index when counts for parameter are 0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219716#M188063</link>
      <description>&lt;P&gt;The problem is that you will only be counting things that have non-zero instances (and he needs the opposite).&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 15:02:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219716#M188063</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-11-05T15:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: setting up alert for search on index when counts for parameter are 0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219717#M188064</link>
      <description>&lt;P&gt;Oh. You're right. Didn't think this through apparently.&lt;BR /&gt;
In that case, ignore the first part of this answer - but the second one might still be useful if you intend to send emails depending on which PStream is affected.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 15:07:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219717#M188064</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-11-05T15:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: setting up alert for search on index when counts for parameter are 0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219718#M188065</link>
      <description>&lt;P&gt;thanks for your suggestion.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 15:33:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219718#M188065</guid>
      <dc:creator>jdepp</dc:creator>
      <dc:date>2015-11-05T15:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: setting up alert for search on index when counts for parameter are 0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219719#M188066</link>
      <description>&lt;P&gt;Thanks for your help. Does this search apply to all where PSTream=* or do I add for each PStream='864', '865', '866'&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;countPstream864 ... count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;why  are there dots in between?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 15:35:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219719#M188066</guid>
      <dc:creator>jdepp</dc:creator>
      <dc:date>2015-11-05T15:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: setting up alert for search on index when counts for parameter are 0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219720#M188067</link>
      <description>&lt;P&gt;The dots are showing you where you need to add your "over 50 of these" (as you put it in your question).  So for the 3 values you just noted, it would look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... source="/statsData.newIndex/tcp/10014" | stats count(eval(PStream="864")) AS countPstream864 count(eval(PStream="865")) AS countPstream865 count(eval(PStream="866")) AS countPstream866 | transpose| rename "row 1" AS count | where count=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Nov 2015 15:39:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/setting-up-alert-for-search-on-index-when-counts-for-parameter/m-p/219720#M188067</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-11-05T15:39:28Z</dc:date>
    </item>
  </channel>
</rss>

