<?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 you group data in 5-minute windows? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-group-data-in-5-minute-windows/m-p/409689#M118187</link>
    <description>&lt;P&gt;Try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="yourindex" sourcetype="yoursourcetype" 
| rex field=_raw "VALUE=\*\*\"(?&amp;lt;VAL&amp;gt;\d+\.\d+)\"\*\*" 
| bin span=5m _time 
| stats avg(VAL) as AVGVAL by _time STEP ZONE CODE 
| eval AVGVAL=round(AVGVAL,2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I had to do the rex because Splunk was auto-extracting **"1965.00000"** instead of just 1965.00000 for the VALUE field.  If you want 5 decimal places, just change the 2 in the last line to 5.  Here is a screenshot of the results of this search:&lt;BR /&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/5876iBC9AC1AA80A3D45B/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>Fri, 05 Oct 2018 19:28:02 GMT</pubDate>
    <dc:creator>kmorris_splunk</dc:creator>
    <dc:date>2018-10-05T19:28:02Z</dc:date>
    <item>
      <title>How do you group data in 5-minute windows?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-group-data-in-5-minute-windows/m-p/409688#M118186</link>
      <description>&lt;P&gt;&lt;STRONG&gt;I have several lines which look like :&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;2018-10-05 15:10:00.000, STEP="STEP1", VALUE="1965.00000", ZONE="CITY1", CODE="GOOD", DATE="201810051510"&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;I want to predict some fields with those lines. But first, I need to pre-process my data. &lt;BR /&gt;
That's why I want to &lt;STRONG&gt;avg&lt;/STRONG&gt; all the &lt;STRONG&gt;VALUE&lt;/STRONG&gt; by every &lt;STRONG&gt;5 minutes window&lt;/STRONG&gt; and by &lt;STRONG&gt;STEP, ZONE, CODE&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;I really don't know how to do this.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Here is an illustration. I want to transform something like :&lt;/STRONG&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2018-10-05 15:10:01.000, STEP="STEP1", VALUE=**"1965.00000"**, ZONE="CITY1", CODE="GOOD", DATE="201810051510"
2018-10-05 15:10:30.000, STEP="STEP1", VALUE=**"1546.00000"**, ZONE="CITY1", CODE="GOOD", DATE="201810051510"
2018-10-05 15:11:21.000, STEP="STEP1", VALUE=**"1452.00000"**, ZONE="CITY1", CODE="GOOD", DATE="201810051510"
2018-10-05 15:13:54.000, STEP="STEP1", VALUE=**"985.00000"**, ZONE="CITY1", CODE="GOOD", DATE="201810051510"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;In one unique line per 5 minutes, STEP, ZONE, CODE something like :&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2018-10-05 15:15:00.000, STEP="STEP1", VALUE=**"1487.00000"**, ZONE="CITY1", CODE="GOOD", DATE="201810051510"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Can you help me ?!&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 13:37:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-group-data-in-5-minute-windows/m-p/409688#M118186</guid>
      <dc:creator>celianouguier</dc:creator>
      <dc:date>2018-10-05T13:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do you group data in 5-minute windows?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-group-data-in-5-minute-windows/m-p/409689#M118187</link>
      <description>&lt;P&gt;Try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="yourindex" sourcetype="yoursourcetype" 
| rex field=_raw "VALUE=\*\*\"(?&amp;lt;VAL&amp;gt;\d+\.\d+)\"\*\*" 
| bin span=5m _time 
| stats avg(VAL) as AVGVAL by _time STEP ZONE CODE 
| eval AVGVAL=round(AVGVAL,2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I had to do the rex because Splunk was auto-extracting **"1965.00000"** instead of just 1965.00000 for the VALUE field.  If you want 5 decimal places, just change the 2 in the last line to 5.  Here is a screenshot of the results of this search:&lt;BR /&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/5876iBC9AC1AA80A3D45B/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>Fri, 05 Oct 2018 19:28:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-group-data-in-5-minute-windows/m-p/409689#M118187</guid>
      <dc:creator>kmorris_splunk</dc:creator>
      <dc:date>2018-10-05T19:28:02Z</dc:date>
    </item>
  </channel>
</rss>

