<?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 Trigger Event Based On Value Of Sorted Search Ouput in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66370#M910</link>
    <description>&lt;P&gt;After scheduling your search you will want to select "if custom condition is met" as your alarm action. Then put the following into your Custom condition search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search sum(MB) &amp;gt; 50
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;where 50 is the "some number" you are referring to in your question.&lt;/P&gt;

&lt;P&gt;I personally would remove the sort and head off of your search and replace chart with stats as such:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal source=*metrics.log splunk_server="*" NOT "*splunk*" starthoursago = 1 | search group="per_host_thruput" | eval MB=kb/1024 | stats sum(MB) by series
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and then use the custom condition search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search sum(MB) &amp;gt; 50
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;as this will alert you on all violating hosts, not just the top violating host.&lt;/P&gt;

&lt;P&gt;For more info on alert conditions see &lt;A href="http://www.splunk.com/base/Documentation/latest/User/SetAlertConditionsFromScheduledSearches" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/latest/User/SetAlertConditionsFromScheduledSearches&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;[EDIT]:&lt;/STRONG&gt;
Yeah looks like the search on the sum(MB) isn't happy. You can work around it by giving the sum a name, as such:
Using your query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal source=*metrics.log splunk_server="*" NOT "*splunk*" starthoursago = 1 | search group="per_host_thruput" | eval MB=kb/1024| chart sum(MB) as sumMBby series | sort - sumMB | head 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or my version&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=_internal source=*metrics.log splunk_server="*" NOT "*splunk*" | search group="per_host_thruput" | eval MB=kb/1024 | stats sum(MB) as sumMB by serie&lt;/CODE&gt;s&lt;/P&gt;

&lt;P&gt;And then setting your custom condition to &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search sumMB &amp;gt; 50
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will work.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Oct 2010 23:33:34 GMT</pubDate>
    <dc:creator>ftk</dc:creator>
    <dc:date>2010-10-07T23:33:34Z</dc:date>
    <item>
      <title>How To Trigger Event Based On Value Of Sorted Search Ouput</title>
      <link>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66369#M909</link>
      <description>&lt;P&gt;I have already setup a saved search to alert on license breaches, but I'm trying to setup a more proactive search that will run every hour to alert on hosts whose throughput is over X number of megabytes. The idea is to be turned onto message floods before we reach our license ceiling. The search criteria below returns the top offending host and the sum of indexed megabytes. I need to setup a scheduled search that will trigger an e-mail with the offending host and sum in the body of the e-mail if the value of the "sum(MB)" field is greater than some number. I'm sure there are advanced alert conditions that can do this, but I haven't been able to figure it out. Any help is appreciated.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal source=*metrics.log splunk_server="*" NOT "*splunk*" starthoursago = 1 | search group="per_host_thruput" | eval MB=kb/1024 | chart sum(MB) by series | sort - sum(MB) | head 1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Oct 2010 22:21:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66369#M909</guid>
      <dc:creator>mallem</dc:creator>
      <dc:date>2010-10-07T22:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: How To Trigger Event Based On Value Of Sorted Search Ouput</title>
      <link>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66370#M910</link>
      <description>&lt;P&gt;After scheduling your search you will want to select "if custom condition is met" as your alarm action. Then put the following into your Custom condition search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search sum(MB) &amp;gt; 50
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;where 50 is the "some number" you are referring to in your question.&lt;/P&gt;

&lt;P&gt;I personally would remove the sort and head off of your search and replace chart with stats as such:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal source=*metrics.log splunk_server="*" NOT "*splunk*" starthoursago = 1 | search group="per_host_thruput" | eval MB=kb/1024 | stats sum(MB) by series
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and then use the custom condition search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search sum(MB) &amp;gt; 50
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;as this will alert you on all violating hosts, not just the top violating host.&lt;/P&gt;

&lt;P&gt;For more info on alert conditions see &lt;A href="http://www.splunk.com/base/Documentation/latest/User/SetAlertConditionsFromScheduledSearches" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/latest/User/SetAlertConditionsFromScheduledSearches&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;[EDIT]:&lt;/STRONG&gt;
Yeah looks like the search on the sum(MB) isn't happy. You can work around it by giving the sum a name, as such:
Using your query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal source=*metrics.log splunk_server="*" NOT "*splunk*" starthoursago = 1 | search group="per_host_thruput" | eval MB=kb/1024| chart sum(MB) as sumMBby series | sort - sumMB | head 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or my version&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=_internal source=*metrics.log splunk_server="*" NOT "*splunk*" | search group="per_host_thruput" | eval MB=kb/1024 | stats sum(MB) as sumMB by serie&lt;/CODE&gt;s&lt;/P&gt;

&lt;P&gt;And then setting your custom condition to &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search sumMB &amp;gt; 50
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will work.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2010 23:33:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66370#M910</guid>
      <dc:creator>ftk</dc:creator>
      <dc:date>2010-10-07T23:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: How To Trigger Event Based On Value Of Sorted Search Ouput</title>
      <link>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66371#M911</link>
      <description>&lt;P&gt;I tried using your recommended expression, along with "search sum(MB) &amp;gt; 50" as the custom condition search, but it doesn't trigger any e-mails. I reduced the "search sum(MB)" to "&amp;gt; 1", but still nothing. I retried using my search expression. Still nothing.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2010 02:40:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66371#M911</guid>
      <dc:creator>mallem</dc:creator>
      <dc:date>2010-10-08T02:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: How To Trigger Event Based On Value Of Sorted Search Ouput</title>
      <link>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66372#M912</link>
      <description>&lt;P&gt;You are right. The search on sum(MB) isn't happy -- work around it by renaming the sum field. I edited the answer.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2010 20:03:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66372#M912</guid>
      <dc:creator>ftk</dc:creator>
      <dc:date>2010-10-08T20:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: How To Trigger Event Based On Value Of Sorted Search Ouput</title>
      <link>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66373#M913</link>
      <description>&lt;P&gt;I updated the answer. Check it out.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2010 20:04:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66373#M913</guid>
      <dc:creator>ftk</dc:creator>
      <dc:date>2010-10-08T20:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: How To Trigger Event Based On Value Of Sorted Search Ouput</title>
      <link>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66374#M914</link>
      <description>&lt;P&gt;That worked! Thank you! Interesting that piping to "head" pulls the bottom offending hosts, but changing to the "tail" pulls in the top offending hosts in the below example. Opposite of the behavior I expected.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal source=*metrics.log splunk_server="*" NOT "*splunk*" startminutesago=60 | search group="per_host_thruput" | eval MB=kb/1024 | stats sum(MB) as sumMB by series | sort sumMB | tail 10
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Oct 2010 02:15:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66374#M914</guid>
      <dc:creator>mallem</dc:creator>
      <dc:date>2010-10-13T02:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: How To Trigger Event Based On Value Of Sorted Search Ouput</title>
      <link>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66375#M915</link>
      <description>&lt;P&gt;If someone provided an answer that solved your issue, kindly click the "accept" checkbox next to so that it is marked as answered and the answerer receives their rep points for the help.  Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Oct 2010 05:25:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66375#M915</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2010-10-15T05:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: How To Trigger Event Based On Value Of Sorted Search Ouput</title>
      <link>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66376#M916</link>
      <description>&lt;P&gt;mallem, I'd love if you could share the search you are using to alert on license breaches.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Nov 2010 03:38:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66376#M916</guid>
      <dc:creator>eclypse</dc:creator>
      <dc:date>2010-11-13T03:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: How To Trigger Event Based On Value Of Sorted Search Ouput</title>
      <link>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66377#M917</link>
      <description>&lt;P&gt;Sorry it took me so long to respond. The saved search to alert on license breaches is below:&lt;/P&gt;

&lt;P&gt;index=_internal source=*license_audit.log LicenseManager-Audit | delta quotaExceededCount as quotadiff | stats first(quotadiff) as quotadiff | search quotadiff&amp;gt;0&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2010 22:59:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66377#M917</guid>
      <dc:creator>mallem</dc:creator>
      <dc:date>2010-11-19T22:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: How To Trigger Event Based On Value Of Sorted Search Ouput</title>
      <link>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66378#M918</link>
      <description>&lt;P&gt;This search has been particularly helpful to me to nail down top offending servers. It can easily be modified to show indexing volume by source and sourcetype too.&lt;/P&gt;

&lt;P&gt;index=_internal source=*metrics.log splunk_server="*" NOT "&lt;EM&gt;splunk&lt;/EM&gt;" | search group="per_host_thruput" | eval MB=kb/1024 | stats sum(MB) as sumMB by series | sort sumMB | tail 10&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2010 23:27:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-To-Trigger-Event-Based-On-Value-Of-Sorted-Search-Ouput/m-p/66378#M918</guid>
      <dc:creator>mallem</dc:creator>
      <dc:date>2010-11-19T23:27:17Z</dc:date>
    </item>
  </channel>
</rss>

