<?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 do I compare count over two time periods? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-compare-count-over-two-time-periods/m-p/347945#M5489</link>
    <description>&lt;P&gt;The exact code depends entirely on what you mean by -1 std dev of change in 15 minutes.  Here are a couple of examples.&lt;/P&gt;

&lt;P&gt;This will look across the last 2 hours and find any minute where the average count for the prior 15 minutes is 1 s.d. below the average across the prior 2 hours.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-2h index=* app=clamav 
| bin _time span=1m 
| stats count as mycount by _time 
| streamstats avg(mycount) as avgcount15, stdev(mycount) as stdevcount15 time_window=15m
| streamstats avg(mycount) as avgcount120, stdev(mycount) as stdevcount120 time_window=2h
| where avgcount15 &amp;lt; avgcount120 - stdevcount120
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This code will find any 15-minute period (2:00-2:15, 2:15-2:30, etc) where the average for the period is 1 s.d. below the average across the prior 2 hours.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-2h index=* app=clamav 
| bin _time span=1m 
| stats count as mycount by _time 
| eventstats avg(mycount) as avgcount120, stdev(mycount) as stdevcount120
| bin _time span=15m
| stats avg(mycount) as mycount15, first(avgcount120) as avgcount120, first(stdevcount120) as stdevcount120 by _time
| where avgcount15 &amp;lt; avgcount120 - stdevcount120
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 08 Mar 2017 22:35:48 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-03-08T22:35:48Z</dc:date>
    <item>
      <title>How do I compare count over two time periods?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-compare-count-over-two-time-periods/m-p/347944#M5488</link>
      <description>&lt;P&gt;All, &lt;/P&gt;

&lt;P&gt;Thought there was a one stop shop command for this, but I can't find it. Basically I just want an alert when I see a drop in count of events. Say I have 1stddev of change in 15 minutes? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* app=clamav | stats count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Mar 2017 23:10:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-I-compare-count-over-two-time-periods/m-p/347944#M5488</guid>
      <dc:creator>daniel333</dc:creator>
      <dc:date>2017-03-07T23:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare count over two time periods?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-compare-count-over-two-time-periods/m-p/347945#M5489</link>
      <description>&lt;P&gt;The exact code depends entirely on what you mean by -1 std dev of change in 15 minutes.  Here are a couple of examples.&lt;/P&gt;

&lt;P&gt;This will look across the last 2 hours and find any minute where the average count for the prior 15 minutes is 1 s.d. below the average across the prior 2 hours.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-2h index=* app=clamav 
| bin _time span=1m 
| stats count as mycount by _time 
| streamstats avg(mycount) as avgcount15, stdev(mycount) as stdevcount15 time_window=15m
| streamstats avg(mycount) as avgcount120, stdev(mycount) as stdevcount120 time_window=2h
| where avgcount15 &amp;lt; avgcount120 - stdevcount120
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This code will find any 15-minute period (2:00-2:15, 2:15-2:30, etc) where the average for the period is 1 s.d. below the average across the prior 2 hours.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-2h index=* app=clamav 
| bin _time span=1m 
| stats count as mycount by _time 
| eventstats avg(mycount) as avgcount120, stdev(mycount) as stdevcount120
| bin _time span=15m
| stats avg(mycount) as mycount15, first(avgcount120) as avgcount120, first(stdevcount120) as stdevcount120 by _time
| where avgcount15 &amp;lt; avgcount120 - stdevcount120
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Mar 2017 22:35:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-I-compare-count-over-two-time-periods/m-p/347945#M5489</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-03-08T22:35:48Z</dc:date>
    </item>
  </channel>
</rss>

