<?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 create an Alert that is triggered if the number of events is over 130 per hour and email a timechart PDF? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157597#M44371</link>
    <description>&lt;P&gt;Never mind my previous comment - I had a typo in the query that is why i was not seeing anything in the statistics window.  After I fixed the typo I did get results in the statistics and visualization tab but it is still single line and not broken down by host.&lt;/P&gt;</description>
    <pubDate>Mon, 15 Jun 2015 20:43:35 GMT</pubDate>
    <dc:creator>bshamsian</dc:creator>
    <dc:date>2015-06-15T20:43:35Z</dc:date>
    <item>
      <title>How to create an Alert that is triggered if the number of events is over 130 per hour and email a timechart PDF?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157590#M44364</link>
      <description>&lt;P&gt;I have an alert that is looking when number of certain events go over a threshold per hour.  For example if number of events is over 130 per hour, we would like a timechart to be emailed that has a breakdown of the events per 5 minute buckets.  &lt;/P&gt;

&lt;P&gt;So I created an alert from the following Splunk search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype=Auth  Was_Degraded="true" | timechart span=5m count by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I set the alert to run once every hour and if number of events is over 130 to send an email.  Unfortunately I never get alerted - I think what is happening is that Splunk is not looking at total number of events that were generated before it was passed to timechart - instead it looks at the output from timechart which is always 12 rows since span is set 5m.  Thus the threshold of greater than 130 is never met.&lt;/P&gt;

&lt;P&gt;I've been looking all over to see if there is a way to create this alert so that it is firing based on the total number of events generated by the first part of the search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype=Auth Was_Degraded="true" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and if it is above a threshold generate and email the timechart  pdf which is needed for troubleshooting the problem.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2015 18:32:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157590#M44364</guid>
      <dc:creator>bshamsian</dc:creator>
      <dc:date>2015-06-15T18:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an Alert that is triggered if the number of events is over 130 per hour and email a timechart PDF?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157591#M44365</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype=Auth Was_Degraded="true" | eventstats count AS totalCount | where totalCount&amp;gt;130 | bucket _time span=5m | stats count by host, _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Jun 2015 18:41:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157591#M44365</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-15T18:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an Alert that is triggered if the number of events is over 130 per hour and email a timechart PDF?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157592#M44366</link>
      <description>&lt;P&gt;I found out your solution during my research but the outputted chart/PDF is not the same as when used by timechart since it does not have breakdown by host.&lt;/P&gt;

&lt;P&gt;Here is what the chart should look like when used with a timechart query:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/389i3915895CD31B4832/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Here is what it looks like using stats and count by host - as you can see the breakdown is NOT by host but across all hosts:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/390iF5FC159E116E9B11/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2015 19:01:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157592#M44366</guid>
      <dc:creator>bshamsian</dc:creator>
      <dc:date>2015-06-15T19:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an Alert that is triggered if the number of events is over 130 per hour and email a timechart PDF?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157593#M44367</link>
      <description>&lt;P&gt;Please look at my reply in as a separate answer - I could not comment on this answer and upload/attach pictures so I had to start a separate answer.  &lt;/P&gt;

&lt;P&gt;Could not get your solution to work with a breakdown by host. &lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2015 19:06:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157593#M44367</guid>
      <dc:creator>bshamsian</dc:creator>
      <dc:date>2015-06-15T19:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an Alert that is triggered if the number of events is over 130 per hour and email a timechart PDF?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157594#M44368</link>
      <description>&lt;P&gt;I blew that, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=main sourcetype=Auth Was_Degraded="true" | eventstats count AS totalCount BY host | where totalCount&amp;gt;130 | bucket _time span=5m | stats count by host, _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Jun 2015 19:10:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157594#M44368</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-15T19:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an Alert that is triggered if the number of events is over 130 per hour and email a timechart PDF?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157595#M44369</link>
      <description>&lt;P&gt;Great minds think alike &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;P&gt;I thought of that and tried it before you suggestion but unfortunately that does not work either - Splunk returns the events but there is no statistics when you add the "BY host" clause on eventstats so there is nothing to chart&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2015 20:26:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157595#M44369</guid>
      <dc:creator>bshamsian</dc:creator>
      <dc:date>2015-06-15T20:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an Alert that is triggered if the number of events is over 130 per hour and email a timechart PDF?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157596#M44370</link>
      <description>&lt;P&gt;It should not return 0 when sorted by host (I do not believe that it does).  Strip off everything after the last pipe character over-and-over until you get data that makes sense and then figure out why adding back on the piped clause breaks things.  What I posted SHOULD work.  The only thing that I can think that might be wrong is that the &lt;CODE&gt;where&lt;/CODE&gt; clause is in the wrong place (but that still would not cause 0 events) like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype=Auth Was_Degraded="true" | eventstats count AS totalCount BY host | bucket _time span=5m | stats count by host, _time,totalCount | where totalCount&amp;gt;130
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Jun 2015 20:41:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157596#M44370</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-15T20:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an Alert that is triggered if the number of events is over 130 per hour and email a timechart PDF?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157597#M44371</link>
      <description>&lt;P&gt;Never mind my previous comment - I had a typo in the query that is why i was not seeing anything in the statistics window.  After I fixed the typo I did get results in the statistics and visualization tab but it is still single line and not broken down by host.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2015 20:43:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157597#M44371</guid>
      <dc:creator>bshamsian</dc:creator>
      <dc:date>2015-06-15T20:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an Alert that is triggered if the number of events is over 130 per hour and email a timechart PDF?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157598#M44372</link>
      <description>&lt;P&gt;Change it to this, then:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   index=main sourcetype=Auth Was_Degraded="true" | eventstats count AS totalCount BY host | where totalCount&amp;gt;130 | timechart span=5m count BY host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Jun 2015 20:58:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157598#M44372</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-15T20:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an Alert that is triggered if the number of events is over 130 per hour and email a timechart PDF?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157599#M44373</link>
      <description>&lt;P&gt;Thanks that worked.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2015 06:35:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157599#M44373</guid>
      <dc:creator>bshamsian</dc:creator>
      <dc:date>2015-06-16T06:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an Alert that is triggered if the number of events is over 130 per hour and email a timechart PDF?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157600#M44374</link>
      <description>&lt;P&gt;Need to remove the first  "BY host"  for this to work - like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype=Auth Was_Degraded="true" | eventstats count AS totalCount | where totalCount&amp;gt;130 | timechart span=5m count BY host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Jun 2015 23:48:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-Alert-that-is-triggered-if-the-number-of-events/m-p/157600#M44374</guid>
      <dc:creator>bshamsian</dc:creator>
      <dc:date>2015-06-16T23:48:06Z</dc:date>
    </item>
  </channel>
</rss>

