<?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 recognize a flat pattern in a given time period? in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223907#M7888</link>
    <description>&lt;P&gt;Getting stdev is easy.  The problem is to search based on 0-stdev in a sub period of the total search, because it is not 0 in the entire search period (in which case I can use an eventstat to identify them).&lt;/P&gt;</description>
    <pubDate>Mon, 14 Sep 2015 22:29:37 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2015-09-14T22:29:37Z</dc:date>
    <item>
      <title>How to recognize a flat pattern in a given time period?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223905#M7886</link>
      <description>&lt;P&gt;I have a search that returns a large number of series of data to be displayed/analyzed easily.  These series show three distinct patterns:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Flat at beginning, rugged after some time.&lt;/LI&gt;
&lt;LI&gt;Irregular throughout.&lt;/LI&gt;
&lt;LI&gt;Zero (flat) at beginning, rugged after some time.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;I want to then search according to each pattern.  This falls into pattern recognition, but for my purposes, a simple method to identify the flat beginning is good enough.  In other words, I only need to "search those with flat beginning greater than 11", "search those with flat beginning of 0", and "search those that are neither."  Is there a simple method to do this?&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/655iF21CE270485A6AB9/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, 14 Sep 2015 20:36:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223905#M7886</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2015-09-14T20:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to recognize a flat pattern in a given time period?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223906#M7887</link>
      <description>&lt;P&gt;You could try using multiple functions in your timechart command, along with some &lt;CODE&gt;| where&lt;/CODE&gt; clauses. If you use the stdev function then you'll be able to detect the flat lines (since stdev would be 0). Take a look at: &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.5/SearchReference/CommonStatsFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.5/SearchReference/CommonStatsFunctions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2015 21:44:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223906#M7887</guid>
      <dc:creator>masonmorales</dc:creator>
      <dc:date>2015-09-14T21:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to recognize a flat pattern in a given time period?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223907#M7888</link>
      <description>&lt;P&gt;Getting stdev is easy.  The problem is to search based on 0-stdev in a sub period of the total search, because it is not 0 in the entire search period (in which case I can use an eventstat to identify them).&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2015 22:29:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223907#M7888</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2015-09-14T22:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to recognize a flat pattern in a given time period?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223908#M7889</link>
      <description>&lt;P&gt;I realize that the original question miss this info: The illustrated time pattern is produced by&lt;BR /&gt;
    | timechart count by ID&lt;BR /&gt;
Some IDs fall into 1, some fall into 2, some fall into 3.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2015 22:58:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223908#M7889</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2015-09-14T22:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to recognize a flat pattern in a given time period?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223909#M7890</link>
      <description>&lt;P&gt;Assume&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| timechart count by ID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And you want to analyze the first 11 time periods reported by timechart, then do this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| bin span=1h _time
| stats count by _time ID
| appendpipe [ head 11
             | stats stddev(count) as sdev avg(count) as avg by ID
             | eval pattern=case(avg&amp;lt;.1,"Zero at beginning",
                                    sdev &amp;lt; .25,"Flat at beginning",
                                    1==1,"Other")
             | fields ID pattern ]
| stats first(pattern) first(count) by _time ID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I think this will give you a starting point. The &lt;CODE&gt;appendpipe&lt;/CODE&gt; takes a copy of the data at that point in the execution pipeline, processes it and appends the results to the main pipeline. Oh, and I set  the time interval to hours in the &lt;CODE&gt;bin&lt;/CODE&gt; command - you could do this using &lt;CODE&gt;timechart&lt;/CODE&gt; as you started, but I think it is easier to use &lt;CODE&gt;bin&lt;/CODE&gt; and &lt;CODE&gt;stats&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2015 23:28:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223909#M7890</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-09-14T23:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to recognize a flat pattern in a given time period?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223910#M7891</link>
      <description>&lt;P&gt;"head" and "appendpipe" (and first()) are what I missed.  Thanks! (Now I want even more commands to zoom in any given internal:-)&lt;/P&gt;

&lt;P&gt;I just realize that "count by _time ID" does not give out 0 for missing values at the two ends. (Strangely, timechart always does.)  I even tried fillnull to no avail. (I know this was encountered in another question, but fillnull seemed to have solved the problem.)  Ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 19:50:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223910#M7891</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2015-09-15T19:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to recognize a flat pattern in a given time period?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223911#M7892</link>
      <description>&lt;P&gt;Bah! I guess the timechart solution is better:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; yoursearchhere
| timechart count by ID
| untable _time ID count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;then &lt;CODE&gt;appendpipe&lt;/CODE&gt; etc as before&lt;/P&gt;

&lt;P&gt;HTH!&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 23:41:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223911#M7892</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-09-15T23:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to recognize a flat pattern in a given time period?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223912#M7893</link>
      <description>&lt;P&gt;Thanks, @lguinn.  &lt;CODE&gt;untable&lt;/CODE&gt; is such a handy command!  I had previously asked about &lt;A href="http://answers.splunk.com/answers/149425/how-to-produce-empty-time-buckets.html"&gt;filling leading zeros&lt;/A&gt;, and got a slim but still lengthy method. (My memory lapsed when I said straight &lt;CODE&gt;fillnull&lt;/CODE&gt; had worked.  It hadn't.)  Will test in other use cases.&lt;/P&gt;

&lt;P&gt;Note after &lt;CODE&gt;untable&lt;/CODE&gt;, head will only return the number of events as in total, and not on a per ID basis.  This is undesired. (For one, there could be more than 11 IDs.)  So &lt;CODE&gt;untable&lt;/CODE&gt; should be performed after &lt;CODE&gt;head&lt;/CODE&gt; inside &lt;CODE&gt;appendpipe&lt;/CODE&gt;.   With this adjustment, and adding max() to criteria,  I can use the following to group my IDs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  yoursearchhere
 | timechart count by ID
 | appendpipe [ head 11
   | untable _time ID count
   | stats stdev(count) as sdev max(count) as max by ID
   | eval pattern=case(max==0,"Zero at beginning",
                       max&amp;gt;0 and sdev &amp;lt; .25,"Flat at beginning",
                       1==1,"No head pattern")
   | fields ID pattern ]
 | stats dc(ID) as Count by pattern
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now, there is a tail pattern in my search, whereby some IDs disappears in the final time periods.  When I tried to use the same &lt;CODE&gt;untable&lt;/CODE&gt; technique, using &lt;CODE&gt;tail&lt;/CODE&gt; in place of &lt;CODE&gt;head&lt;/CODE&gt;, I got no IDs in.  I'll submit as a new question for that one.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2015 19:15:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-recognize-a-flat-pattern-in-a-given-time-period/m-p/223912#M7893</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2015-09-23T19:15:50Z</dc:date>
    </item>
  </channel>
</rss>

