<?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 setup alert on multiple rows in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-to-setup-alert-on-multiple-rows/m-p/69016#M952</link>
    <description>&lt;P&gt;And what if I wanted to also get the total "good" and total "bad" in the report itself? So far its working great though it seems, just want to let it soak in for a few hours.&lt;/P&gt;</description>
    <pubDate>Thu, 27 Dec 2012 17:10:41 GMT</pubDate>
    <dc:creator>cgiatras</dc:creator>
    <dc:date>2012-12-27T17:10:41Z</dc:date>
    <item>
      <title>How to setup alert on multiple rows</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-setup-alert-on-multiple-rows/m-p/69013#M949</link>
      <description>&lt;P&gt;So I setup this search on an apache web log:&lt;/P&gt;

&lt;P&gt;sourcetype="access_common" status=* | top status limit="1000"&lt;/P&gt;

&lt;P&gt;Results are:&lt;/P&gt;

&lt;P&gt;status  count   percent&lt;BR /&gt;
200 250935  96.938500&lt;BR /&gt;
302 3279    1.266708&lt;BR /&gt;
404 1667    0.643977&lt;BR /&gt;
500 1322    0.510701&lt;BR /&gt;
401 819 0.316387&lt;BR /&gt;
301 325 0.125550&lt;BR /&gt;
400 261 0.100827&lt;BR /&gt;
502 197 0.076103&lt;BR /&gt;
206 43  0.016611&lt;BR /&gt;
403 12  0.004636&lt;/P&gt;

&lt;P&gt;Now I want to setup an alert that when the Percent Total for 2* and 3* percent falls below 95%. I will like this full report sent in the alert so not sure how to go about doing so. I know I can do :&lt;/P&gt;

&lt;P&gt;sourcetype="access_common" status=* | top status limit="1000" | where status=2* OR status=3* but again I would like the above report in FULL when receiving the alert.&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2012 16:22:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-setup-alert-on-multiple-rows/m-p/69013#M949</guid>
      <dc:creator>cgiatras</dc:creator>
      <dc:date>2012-12-19T16:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup alert on multiple rows</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-setup-alert-on-multiple-rows/m-p/69014#M950</link>
      <description>&lt;P&gt;You'll need to sum up the percentage of 'good' requests in a custom condition&lt;BR /&gt;
i.e.&lt;/P&gt;

&lt;P&gt;If your base search is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal source=*web_access.log | top status limit=1000 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then you can do a custom condition of &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;appendpipe [ | stats sum(eval(if(match(status,"^[23]"),percent,0))) as percent | eval status="good"] | where status=="good" AND percent &amp;lt; 95
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This adds another line to the results with a status of 'good' and a percent of the sum of all the 2* and 3* statuses, then if that percent is &amp;lt; 95, the alert triggers&lt;/P&gt;

&lt;P&gt;Make sure to tick the box for 'Include results in email' and that the alert mode is 'once per search'&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Update&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;If you find the goob / bad breakdown useful and want to include it in your report here's an alternative.&lt;/P&gt;

&lt;P&gt;The main search becomes :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal source=*web_access.log 
| top status limit=1000     
| eval type=case(match(status,"^[23]"),"good",match(status,"^[45]"),"bad",1==1,"unknown")
| appendpipe [ stats sum(count) as count sum(percent) as percent by type 
               | rename type as status ] 
| fields - type
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and the custom condition in the alert simply becomes : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;where status=="good" AND percent &amp;lt; 95
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Dec 2012 22:20:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-setup-alert-on-multiple-rows/m-p/69014#M950</guid>
      <dc:creator>jonuwz</dc:creator>
      <dc:date>2012-12-19T22:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup alert on multiple rows</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-setup-alert-on-multiple-rows/m-p/69015#M951</link>
      <description>&lt;P&gt;Thanks Jonuwz . Will try this later today and let you know how it worked!&lt;/P&gt;</description>
      <pubDate>Thu, 27 Dec 2012 15:05:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-setup-alert-on-multiple-rows/m-p/69015#M951</guid>
      <dc:creator>cgiatras</dc:creator>
      <dc:date>2012-12-27T15:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup alert on multiple rows</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-setup-alert-on-multiple-rows/m-p/69016#M952</link>
      <description>&lt;P&gt;And what if I wanted to also get the total "good" and total "bad" in the report itself? So far its working great though it seems, just want to let it soak in for a few hours.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Dec 2012 17:10:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-setup-alert-on-multiple-rows/m-p/69016#M952</guid>
      <dc:creator>cgiatras</dc:creator>
      <dc:date>2012-12-27T17:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup alert on multiple rows</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-setup-alert-on-multiple-rows/m-p/69017#M953</link>
      <description>&lt;P&gt;I came up with this:&lt;/P&gt;

&lt;P&gt;sourcetype="access_common" status=* | top status limit="1000" | appendpipe [ | stats sum(eval(if(match(status,"^[23]"),percent,0))) as percent | eval status="good"] |appendpipe [ | stats sum(eval(if(match(status,"^[45]"),percent,0))) as percent | eval status="bad"]&lt;/P&gt;</description>
      <pubDate>Thu, 27 Dec 2012 17:39:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-setup-alert-on-multiple-rows/m-p/69017#M953</guid>
      <dc:creator>cgiatras</dc:creator>
      <dc:date>2012-12-27T17:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup alert on multiple rows</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-setup-alert-on-multiple-rows/m-p/69018#M954</link>
      <description>&lt;P&gt;updated with sample code for the good / bad stats in the report&lt;/P&gt;</description>
      <pubDate>Thu, 27 Dec 2012 18:44:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-setup-alert-on-multiple-rows/m-p/69018#M954</guid>
      <dc:creator>jonuwz</dc:creator>
      <dc:date>2012-12-27T18:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup alert on multiple rows</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-setup-alert-on-multiple-rows/m-p/69019#M955</link>
      <description>&lt;P&gt;Thanks Jonuwz that looks great!&lt;/P&gt;</description>
      <pubDate>Fri, 28 Dec 2012 14:56:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-setup-alert-on-multiple-rows/m-p/69019#M955</guid>
      <dc:creator>cgiatras</dc:creator>
      <dc:date>2012-12-28T14:56:59Z</dc:date>
    </item>
  </channel>
</rss>

