<?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 generate a search to find the number of days that exceeds mean by certain ranges? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-find-the-number-of-days-that-exceeds/m-p/347485#M102919</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;index="index" field="field" sourcetype="sourcetype"
| bucket _time span=1d 
| stats count as EventCount by _time

| rename COMMENT as "This section adds records for the days which had zero counts.  Remove if unwanted."
| appendpipe [| stats min(_time) as mintime max(_time) as maxtime | eval _time=mvrange(mintime,maxtime,86400) | eval EventCount=0]
| stats max(EventCount) as EventCount by _time

| rename COMMENT as "This section calculates which days were beyond n stdevs, and sets a flag to count them up."  
| eventstats avg(EventCount) as avgEventCount stdev(EventCount) as stdevEventCount 
| eval logs1=if(EventCount&amp;gt; avgEventCount+1*stdevEventCount,1,0)
| eval logs2=if(EventCount&amp;gt; avgEventCount+2*stdevEventCount,1,0)
| eval logs3=if(EventCount&amp;gt; avgEventCount+3*stdevEventCount,1,0)

| rename COMMENT as "This section adds records to show the specific dates beyond n stdevs, for test purposes.  Remove when working if unwanted."  
| eval day = strftime(_time,"%Y-%m-%d")
| eval days1=if(EventCount&amp;gt; avgEventCount+1*stdevEventCount,day,0)
| eval days2=if(EventCount&amp;gt; avgEventCount+2*stdevEventCount,day,0)
| eval days3=if(EventCount&amp;gt; avgEventCount+3*stdevEventCount,day,0)

| rename COMMENT as "This section calculates and reports your answers."  
| stats sum(log*) as log*, values(day*) as day* 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 15 Jun 2017 18:51:05 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-06-15T18:51:05Z</dc:date>
    <item>
      <title>How to generate a search to find the number of days that exceeds mean by certain ranges?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-find-the-number-of-days-that-exceeds/m-p/347483#M102917</link>
      <description>&lt;P&gt;Hello all!&lt;/P&gt;

&lt;P&gt;I'm trying to find the number of days that the daily count of my event exceeds the daily mean + standard deviation for a 3-week period. I also need to return the number of days that exceeds the mean + 2 stdevs and mean + 3 stdevs, and keep it all together.&lt;/P&gt;

&lt;P&gt;Is there an easy way to do this?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 16:37:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-find-the-number-of-days-that-exceeds/m-p/347483#M102917</guid>
      <dc:creator>jrnastase</dc:creator>
      <dc:date>2017-06-15T16:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search to find the number of days that exceeds mean by certain ranges?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-find-the-number-of-days-that-exceeds/m-p/347484#M102918</link>
      <description>&lt;P&gt;If it helps, this is what I tried before, but it only works if values exist for logs++&lt;/P&gt;

&lt;P&gt;index="index" field = "field" sourcetype="sourcetype"&lt;BR /&gt;
| bucket _time span=1d &lt;BR /&gt;
| stats count by _time &lt;BR /&gt;
| eventstats avg(count) as average stdev(count) as standard_deviation&lt;BR /&gt;&lt;BR /&gt;
| where count&amp;gt;average+standard_deviation &lt;BR /&gt;
| eventstats count as logs &lt;BR /&gt;
| where count&amp;gt;average+(2*standard_deviation) &lt;BR /&gt;
| eventstats count as logs+ &lt;BR /&gt;
| where count&amp;gt;average+(3*standard_deviation) &lt;BR /&gt;
| eventstats count as logs++&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:28:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-find-the-number-of-days-that-exceeds/m-p/347484#M102918</guid>
      <dc:creator>jrnastase</dc:creator>
      <dc:date>2020-09-29T14:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search to find the number of days that exceeds mean by certain ranges?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-find-the-number-of-days-that-exceeds/m-p/347485#M102919</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index="index" field="field" sourcetype="sourcetype"
| bucket _time span=1d 
| stats count as EventCount by _time

| rename COMMENT as "This section adds records for the days which had zero counts.  Remove if unwanted."
| appendpipe [| stats min(_time) as mintime max(_time) as maxtime | eval _time=mvrange(mintime,maxtime,86400) | eval EventCount=0]
| stats max(EventCount) as EventCount by _time

| rename COMMENT as "This section calculates which days were beyond n stdevs, and sets a flag to count them up."  
| eventstats avg(EventCount) as avgEventCount stdev(EventCount) as stdevEventCount 
| eval logs1=if(EventCount&amp;gt; avgEventCount+1*stdevEventCount,1,0)
| eval logs2=if(EventCount&amp;gt; avgEventCount+2*stdevEventCount,1,0)
| eval logs3=if(EventCount&amp;gt; avgEventCount+3*stdevEventCount,1,0)

| rename COMMENT as "This section adds records to show the specific dates beyond n stdevs, for test purposes.  Remove when working if unwanted."  
| eval day = strftime(_time,"%Y-%m-%d")
| eval days1=if(EventCount&amp;gt; avgEventCount+1*stdevEventCount,day,0)
| eval days2=if(EventCount&amp;gt; avgEventCount+2*stdevEventCount,day,0)
| eval days3=if(EventCount&amp;gt; avgEventCount+3*stdevEventCount,day,0)

| rename COMMENT as "This section calculates and reports your answers."  
| stats sum(log*) as log*, values(day*) as day* 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Jun 2017 18:51:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-find-the-number-of-days-that-exceeds/m-p/347485#M102919</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-06-15T18:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a search to find the number of days that exceeds mean by certain ranges?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-find-the-number-of-days-that-exceeds/m-p/347486#M102920</link>
      <description>&lt;P&gt;Check out this Q&amp;amp;A for a very in-depth conversation on this topic (don't forget to up-vote):&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/511894/how-to-use-the-timewrap-command-and-set-an-alert-f.html#answer-512022"&gt;https://answers.splunk.com/answers/511894/how-to-use-the-timewrap-command-and-set-an-alert-f.html#answer-512022&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 20:21:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-search-to-find-the-number-of-days-that-exceeds/m-p/347486#M102920</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-15T20:21:39Z</dc:date>
    </item>
  </channel>
</rss>

