<?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 extract a numeric value from my field and create an average? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257415#M77097</link>
    <description>&lt;P&gt;Now remove the field=messages_read and total/interval/max and it'll be a ok.  I wouldn't have posted a new answer if sundareshr's answer didn't have so many mistakes.  You'll see where I just offer corrections in comments when folks are close.  Now however his updated answer has an extra ? too.  &lt;/P&gt;</description>
    <pubDate>Thu, 19 May 2016 16:52:26 GMT</pubDate>
    <dc:creator>jkat54</dc:creator>
    <dc:date>2016-05-19T16:52:26Z</dc:date>
    <item>
      <title>How to extract a numeric value from my field and create an average?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257407#M77089</link>
      <description>&lt;P&gt;I have created a field extraction for the data I am looking for.  The field looks as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;messages_read total/interval/max=11581602/2067/3143
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This line in the messages is received approximately every 10 sec.  I would like to be able to extract the 2067 which is the number of messages read in the last 10 sec and obtain an average of the messages read over a specified amount of time, i.e. an hour or 24 hours.&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2016 14:18:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257407#M77089</guid>
      <dc:creator>UCOP</dc:creator>
      <dc:date>2016-05-18T14:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a numeric value from my field and create an average?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257408#M77090</link>
      <description>&lt;P&gt;Like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | rex field=messages_read total/interval/max "\d+\/\(?&amp;lt;interval&amp;gt;d+)\/" | timechart span=1h avg(interval) AS avgInterval
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can adjust the span to s, m, h,  d, w, mon etc.&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2016 16:25:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257408#M77090</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-05-18T16:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a numeric value from my field and create an average?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257409#M77091</link>
      <description>&lt;P&gt;Thank you for your quick response.  I received the following error:&lt;/P&gt;

&lt;P&gt;Error in 'rex' command: The regex 'total/interval/max' does not extract anything. It should specify at least one named group. Format: (?...). &lt;/P&gt;

&lt;P&gt;The full search string is as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* OR index=_* source="/zones/COP1/root/var/svc/log/application-ucop-topcop-pub:default.log" | rex field=messages_read total/interval/max "\d+\/\(?d+)\/" | timechart span=1h avg(interval) AS avgInterval
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So I am sure I am doing something wrong.&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 15:01:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257409#M77091</guid>
      <dc:creator>UCOP</dc:creator>
      <dc:date>2016-05-19T15:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a numeric value from my field and create an average?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257410#M77092</link>
      <description>&lt;P&gt;See if this works:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index= OR index=_ source="/zones/COP1/root/var/svc/log/application-ucop-topcop-pub:default.log" | rex "\d+\/(?&amp;lt;interval&amp;gt;\d+)\/"| timechart span=1h avg(interval) AS avgInterval&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 15:26:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257410#M77092</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-05-19T15:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a numeric value from my field and create an average?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257411#M77093</link>
      <description>&lt;P&gt;I had the starting quote in the wrong place. Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | rex field=messages_read "total/interval/max=?\d+\/\(?&amp;lt;interval&amp;gt;d+)\/" | timechart span=1h avg(interval) AS avgInterval
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | rex field=messages_read "?\d+\/\(?&amp;lt;interval&amp;gt;d+)\/" | timechart span=1h avg(interval) AS avgInterval
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 May 2016 15:32:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257411#M77093</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-05-19T15:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a numeric value from my field and create an average?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257412#M77094</link>
      <description>&lt;P&gt;There is an additional slash in the answer. This should work fine.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Updated&lt;/STRONG&gt; &lt;BR /&gt;
Good catch by @jkat54&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; .... | rex field=messages_read total/interval/max "\d+\/(?&amp;lt;interval&amp;gt;\d+)\/" | timechart span=1h avg(interval) AS avgInterval
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 May 2016 15:35:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257412#M77094</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-19T15:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a numeric value from my field and create an average?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257413#M77095</link>
      <description>&lt;P&gt;Okay.  It looks like it is getting closer.&lt;/P&gt;

&lt;P&gt;I am using the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/zones/COP1/root/var/svc/log/application-ucop-topcop-pub:default.log" | rex field=messages_read "total/interval/max=?\d+\/(?d+)\/" | timechart span=1h avg(interval) AS avgInterval
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;On the Statistics tab there is a _time column and a avgInterval column, but there is nothing listed in the avgInterval column.  Would I expect to see a number in that column, equating to an average of all the results for an hour?&lt;/P&gt;

&lt;P&gt;Much appreciated!&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 16:12:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257413#M77095</guid>
      <dc:creator>UCOP</dc:creator>
      <dc:date>2016-05-19T16:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a numeric value from my field and create an average?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257414#M77096</link>
      <description>&lt;P&gt;Need a slash in front of the d+ in the capture group and the field name isn't messages_read.  The answer I gave should work fine.&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 16:31:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257414#M77096</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-05-19T16:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a numeric value from my field and create an average?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257415#M77097</link>
      <description>&lt;P&gt;Now remove the field=messages_read and total/interval/max and it'll be a ok.  I wouldn't have posted a new answer if sundareshr's answer didn't have so many mistakes.  You'll see where I just offer corrections in comments when folks are close.  Now however his updated answer has an extra ? too.  &lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 16:52:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-numeric-value-from-my-field-and-create-an/m-p/257415#M77097</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-05-19T16:52:26Z</dc:date>
    </item>
  </channel>
</rss>

