<?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: Rex help with decimal numbers in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41938#M9737</link>
    <description>&lt;P&gt;Hi sdaniels,&lt;/P&gt;

&lt;P&gt;Sorry for the incomplete information in my post above. Actually I am trying to capture 1minmax(int number), 1minavg(decimal number) etc in addition to jco_total.&lt;/P&gt;

&lt;P&gt;sourcetype="oss6" | rex "JCOConnections:Total=(?&lt;JCO_TOTAL&gt;d+)(.)=((?&amp;lt;1minmax&amp;gt;d+),(?&amp;lt;1minavg&amp;gt;d+.?d);(?&amp;lt;5minmax&amp;gt;d+),(?&amp;lt;5minavg&amp;gt;d+.?d);&lt;BR /&gt;
(?&amp;lt;60minmax&amp;gt;d+),(?&amp;lt;60minavg&amp;gt;d+.?d);(?&amp;lt;24hrmax&amp;gt;d+),(?&amp;lt;24hravg&amp;gt;d+.?d*);)"&lt;/JCO_TOTAL&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 02 May 2012 17:34:29 GMT</pubDate>
    <dc:creator>rguntupalli8</dc:creator>
    <dc:date>2012-05-02T17:34:29Z</dc:date>
    <item>
      <title>Rex help with decimal numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41935#M9734</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
Below is not working. can you please help. &lt;BR /&gt;
I am trying to capture 1minmax(int number), 1minavg(decimal number) etc in addition to jco_total.&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;| dtm=2012-04-29 05:30:00.00 PDT | priority=INFO | Timer-_default MonitorJCOConnectionsTask:&lt;BR /&gt;&lt;BR /&gt;
JCOConnections:Total=48(1M;5M;60M;24H)=(1,1.33;3,2,2.56;3,3.66;5,1.82;)&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;sourcetype="oss6" | rex "JCOConnections:Total=(?&lt;JCO_TOTAL&gt;d+)(.)=((?&amp;lt;1minmax&amp;gt;d+),(?&amp;lt;1minavg&amp;gt;d+.?d);(?&amp;lt;5minmax&amp;gt;d+),(?&amp;lt;5minavg&amp;gt;d+.?d);&lt;BR /&gt;
(?&amp;lt;60minmax&amp;gt;d+),(?&amp;lt;60minavg&amp;gt;d+.?d);(?&amp;lt;24hrmax&amp;gt;d+),(?&amp;lt;24hravg&amp;gt;d+.?d*);)"&lt;/JCO_TOTAL&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2012 17:07:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41935#M9734</guid>
      <dc:creator>rguntupalli8</dc:creator>
      <dc:date>2012-05-02T17:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Rex help with decimal numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41936#M9735</link>
      <description>&lt;P&gt;Used this rex, but not working still.&lt;BR /&gt;
sourcetype="oss6" | rex "JCOConnections:Total=(?&lt;JCO_TOTAL&gt;\d+)(1M;5M;60M;24H)=(\d+,\d+.?\d*;\d+,\d+.?\d*;\d+,\d+.?\d*;\d+,\d+.?\d*;)&lt;/JCO_TOTAL&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:46:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41936#M9735</guid>
      <dc:creator>rguntupalli8</dc:creator>
      <dc:date>2020-09-28T11:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Rex help with decimal numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41937#M9736</link>
      <description>&lt;P&gt;Are you just trying to capture the number 48 for the total number of connections?&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2012 17:28:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41937#M9736</guid>
      <dc:creator>sdaniels</dc:creator>
      <dc:date>2012-05-02T17:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: Rex help with decimal numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41938#M9737</link>
      <description>&lt;P&gt;Hi sdaniels,&lt;/P&gt;

&lt;P&gt;Sorry for the incomplete information in my post above. Actually I am trying to capture 1minmax(int number), 1minavg(decimal number) etc in addition to jco_total.&lt;/P&gt;

&lt;P&gt;sourcetype="oss6" | rex "JCOConnections:Total=(?&lt;JCO_TOTAL&gt;d+)(.)=((?&amp;lt;1minmax&amp;gt;d+),(?&amp;lt;1minavg&amp;gt;d+.?d);(?&amp;lt;5minmax&amp;gt;d+),(?&amp;lt;5minavg&amp;gt;d+.?d);&lt;BR /&gt;
(?&amp;lt;60minmax&amp;gt;d+),(?&amp;lt;60minavg&amp;gt;d+.?d);(?&amp;lt;24hrmax&amp;gt;d+),(?&amp;lt;24hravg&amp;gt;d+.?d*);)"&lt;/JCO_TOTAL&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2012 17:34:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41938#M9737</guid>
      <dc:creator>rguntupalli8</dc:creator>
      <dc:date>2012-05-02T17:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: Rex help with decimal numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41939#M9738</link>
      <description>&lt;P&gt;You may want to update your question above.&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2012 17:37:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41939#M9738</guid>
      <dc:creator>sdaniels</dc:creator>
      <dc:date>2012-05-02T17:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: Rex help with decimal numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41940#M9739</link>
      <description>&lt;P&gt;updated. Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2012 17:46:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41940#M9739</guid>
      <dc:creator>rguntupalli8</dc:creator>
      <dc:date>2012-05-02T17:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Rex help with decimal numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41941#M9740</link>
      <description>&lt;P&gt;Note that in order for you to get a \ in the text of what you're providing, you have to escape it.  You may well have \d or \., but it's showing up as just d or ., which don't have the same meaning.  \d != d.&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2012 19:02:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41941#M9740</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2012-05-02T19:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: Rex help with decimal numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41942#M9741</link>
      <description>&lt;P&gt;In "regular expression-ese", \d is &lt;EM&gt;just&lt;/EM&gt; a digit.  You may have these correct with literal .'s and \If I try to match \d against "1.33", I'm going to get 1.  &lt;/P&gt;

&lt;P&gt;Next, I don't know if you've transcribed your event correctly, or if you cut-and-pasted.  It looks like the format of the parenthetical should be &lt;EM&gt;int&lt;/EM&gt; comma &lt;EM&gt;float&lt;/EM&gt; semicolon, and then three more groups like that.  The pasted event shows 3,2,2.56; as the second group in that form.&lt;/P&gt;

&lt;P&gt;Consider testing with &lt;A href="http://gskinner.com/RegExr/"&gt;RegExr&lt;/A&gt;; it'll be faster to triage the problem and &lt;EM&gt;then&lt;/EM&gt; paste into rex in the search bar.&lt;/P&gt;

&lt;P&gt;Using your input &lt;EM&gt;exactly&lt;/EM&gt; as provided, I wrote the following regex (minus the field names) to match it:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;BR /&gt;
JCOConnections:Total=(\d+)\(.*\)=\((\d+),([\d.]+);(\d+),(\d+),([\d.]+);(\d+),([\d.]+);(\d+),([\d.]+);\)&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2012 19:13:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41942#M9741</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2012-05-02T19:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Rex help with decimal numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41943#M9742</link>
      <description>&lt;P&gt;There are some errors in your regex:&lt;/P&gt;

&lt;P&gt;you are not matching all necessary stuff between the '48' and values for 1minmax. Also, there are nine values in the last parentheses, whereas you only specify eight extractions. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; rex "JCOConnections:Total=(?&amp;lt;jco_total&amp;gt;d+)(.)=((?&amp;lt;1minmax&amp;gt;d+),(?&amp;lt;1minavg&amp;gt;d+.?d);(?&amp;lt;5minmax&amp;gt;d+),(?&amp;lt;5minavg&amp;gt;d+.?d); (?&amp;lt;60minmax&amp;gt;d+),(?&amp;lt;60minavg&amp;gt;d+.?d);(?&amp;lt;24hrmax&amp;gt;d+),(?&amp;lt;24hravg&amp;gt;d+.?d*);)" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;given (part of) the message;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;JCOConnections:Total=48(1M;5M;60M;24H)=(1,1.33;3,2,2.56;3,3.66;5,1.82;)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you could get your values by;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex "JCOConnections:Total=(?&amp;lt;jco_total&amp;gt;d+)\([124560HM;]+\)=\((?&amp;lt;1mmax&amp;gt;[^,]+),(?&amp;lt;1mavg&amp;gt;[^;]+);(?&amp;lt;5mmax&amp;gt;[^,]+),(?&amp;lt;5mavg&amp;gt;[^;]+);(?&amp;lt;60mmax&amp;gt;[^,]+),(?&amp;lt;60mavg&amp;gt;[^;]+);(?&amp;lt;24hmax&amp;gt;[^,]+),(?&amp;lt;24havg&amp;gt;[^;]+);\)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Still need to remove one value in the log (there are 3 values for the 5min part ( 3, 2, and 2.56)), or add another extraction. &lt;/P&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;Kristian&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2012 19:25:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41943#M9742</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2012-05-02T19:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Rex help with decimal numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41944#M9743</link>
      <description>&lt;P&gt;Hi Kristian,&lt;BR /&gt;
ThankYou. Noted the 3 values issue in the log.&lt;BR /&gt;
Does this work to extract decimal values above ex: 2.56&lt;BR /&gt;
Dont we need something like this to extract decimal values?&lt;BR /&gt;
(?&amp;lt;1minMAX&amp;gt;\d+),(?&amp;lt;1minAVG&amp;gt;\d+.?\d*);&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2012 21:28:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41944#M9743</guid>
      <dc:creator>rguntupalli8</dc:creator>
      <dc:date>2012-05-02T21:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Rex help with decimal numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41945#M9744</link>
      <description>&lt;P&gt;well, yes. Consider the following:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;,(?&lt;BLAHAH&gt;[^;]+);&lt;/BLAHAH&gt;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;this will;&lt;BR /&gt;
start matching after a colon (,)&lt;BR /&gt;
match any character that is NOT a semicolon ([^;])&lt;BR /&gt;
for one or more characters (+)&lt;BR /&gt;
and store them as the field 'blaha' (?&lt;BLAHA&gt;)&lt;BR /&gt;
followed by a semicolon (;)&lt;/BLAHA&gt;&lt;/P&gt;

&lt;P&gt;so the contents of &lt;CODE&gt;blaha&lt;/CODE&gt; could be&lt;BR /&gt;
AAA&lt;BR /&gt;
123.43&lt;/P&gt;

&lt;H1&gt;¤!%&amp;amp;&lt;/H1&gt;

&lt;P&gt;as long as it's not a semicolon.&lt;/P&gt;

&lt;P&gt;/k&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2012 21:43:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-help-with-decimal-numbers/m-p/41945#M9744</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2012-05-02T21:43:30Z</dc:date>
    </item>
  </channel>
</rss>

