<?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: Regular expression and aggregate the result in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regular-expression-and-aggregate-the-result/m-p/289600#M165055</link>
    <description>&lt;P&gt;Removed &lt;CODE&gt;\s&lt;/CODE&gt; from &lt;CODE&gt;(?\s+\d+)&lt;/CODE&gt; in the &lt;CODE&gt;rex&lt;/CODE&gt; command. You need not use &lt;CODE&gt;| convert num(TIME)&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
|  rex field=_raw "appx\):\s+\d+\.\d+\s+(?&amp;lt;TIME&amp;gt;\d+)"
|  stats avg(TIME)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out and confirm.&lt;/P&gt;</description>
    <pubDate>Fri, 17 Nov 2017 19:14:44 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-11-17T19:14:44Z</dc:date>
    <item>
      <title>Regular expression and aggregate the result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regular-expression-and-aggregate-the-result/m-p/289599#M165054</link>
      <description>&lt;P&gt;Assume the following records:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Nov 17 19:24:51 x.x.x.x Nov 17 19:24:51 myserver (appx): 1510943091.801 520 192.168.0.5 CONNECT something else
Nov 17 19:24:51 x.x.x.x Nov 17 19:24:51 myserver (appx): 1510943091.801 1040 192.168.0.5 CONNECT something else
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The above record is a modied squid log and i'd like to get the average response time, in this case it's the value of &lt;STRONG&gt;520 and 1040&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;My query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; myserver |  rex field=_raw "appx\):\s+\d+\.\d+\s+(?&amp;lt;TIME&amp;gt;\s+\d+)"  |  convert num(TIME)   | stats avg(TIME) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Somehow the avg aggregate returns nothing but using the min/max aggregate returns a value.&lt;BR /&gt;
Whats wrong with the query?&lt;/P&gt;

&lt;P&gt;Thanks..&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 19:04:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regular-expression-and-aggregate-the-result/m-p/289599#M165054</guid>
      <dc:creator>mkrauss1</dc:creator>
      <dc:date>2017-11-17T19:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression and aggregate the result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regular-expression-and-aggregate-the-result/m-p/289600#M165055</link>
      <description>&lt;P&gt;Removed &lt;CODE&gt;\s&lt;/CODE&gt; from &lt;CODE&gt;(?\s+\d+)&lt;/CODE&gt; in the &lt;CODE&gt;rex&lt;/CODE&gt; command. You need not use &lt;CODE&gt;| convert num(TIME)&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
|  rex field=_raw "appx\):\s+\d+\.\d+\s+(?&amp;lt;TIME&amp;gt;\d+)"
|  stats avg(TIME)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out and confirm.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 19:14:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regular-expression-and-aggregate-the-result/m-p/289600#M165055</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-17T19:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression and aggregate the result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regular-expression-and-aggregate-the-result/m-p/289601#M165056</link>
      <description>&lt;P&gt;Interesting lesson, that works for me, THANKS!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 19:27:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regular-expression-and-aggregate-the-result/m-p/289601#M165056</guid>
      <dc:creator>mkrauss1</dc:creator>
      <dc:date>2017-11-17T19:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression and aggregate the result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regular-expression-and-aggregate-the-result/m-p/289602#M165057</link>
      <description>&lt;P&gt;@mkrauss1, you can use regex101.com for testing and creating regular expression for your sample events. It also has a quick reference of regular expression and gives you step by step information of each regular expression pattern match.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 19:47:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regular-expression-and-aggregate-the-result/m-p/289602#M165057</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-17T19:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression and aggregate the result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regular-expression-and-aggregate-the-result/m-p/289603#M165058</link>
      <description>&lt;P&gt;I never became a friend of regexbody but regex101.com looks very interesting. Thanks again!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 19:52:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regular-expression-and-aggregate-the-result/m-p/289603#M165058</guid>
      <dc:creator>mkrauss1</dc:creator>
      <dc:date>2017-11-17T19:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression and aggregate the result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regular-expression-and-aggregate-the-result/m-p/289604#M165059</link>
      <description>&lt;P&gt;If you want to pick up on Regular Expressions you should see .conf 2017 presentation on   "Beyond Regular Regular Expressions" by Cary Petterborg, our regex "guru" and Splunk Trust member.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://conf.splunk.com/sessions/2017-sessions.html#search=Beyond%20REGULAR%20Regular%20Expressions&amp;amp;"&gt;http://conf.splunk.com/sessions/2017-sessions.html#search=Beyond%20REGULAR%20Regular%20Expressions&amp;amp;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Nov 2017 05:09:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regular-expression-and-aggregate-the-result/m-p/289604#M165059</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-18T05:09:22Z</dc:date>
    </item>
  </channel>
</rss>

