<?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 - extract 2 single values from set of numbers in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/rex-extract-2-single-values-from-set-of-numbers/m-p/457062#M171184</link>
    <description>&lt;P&gt;Hey @splunkuseradmin ,&lt;/P&gt;

&lt;P&gt;Try using this regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "^server:\s\[\w+\]\s:\s{\"\d+\"\s\:\s\[\d+,(?P&amp;lt;conferences&amp;gt;\d+.\d+[^,]),\d+.\d+,(?P&amp;lt;calls&amp;gt;\d+),\d+\]\}"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know if this helps!!&lt;/P&gt;</description>
    <pubDate>Fri, 17 May 2019 11:59:42 GMT</pubDate>
    <dc:creator>deepashri_123</dc:creator>
    <dc:date>2019-05-17T11:59:42Z</dc:date>
    <item>
      <title>rex - extract 2 single values from set of numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-extract-2-single-values-from-set-of-numbers/m-p/457061#M171183</link>
      <description>&lt;P&gt;hello guyz,&lt;/P&gt;

&lt;P&gt;new to splunk was to figure out solution for this.&lt;BR /&gt;
I have logs like below need to do " rex" and extract 2 values (1st and 4th) from each log with set like [23,23.000,89.375,35,0], [1,1.000,16.000,4,0] etc. &lt;BR /&gt;
ex.,&lt;BR /&gt;
value1- "23" and save in new field with name conferences from every log&lt;BR /&gt;
value4- "35" and save in new field with name calls from every log&lt;BR /&gt;
thanks&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 00:34:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-extract-2-single-values-from-set-of-numbers/m-p/457061#M171183</guid>
      <dc:creator>splunkuseradmin</dc:creator>
      <dc:date>2019-05-17T00:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: rex - extract 2 single values from set of numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-extract-2-single-values-from-set-of-numbers/m-p/457062#M171184</link>
      <description>&lt;P&gt;Hey @splunkuseradmin ,&lt;/P&gt;

&lt;P&gt;Try using this regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "^server:\s\[\w+\]\s:\s{\"\d+\"\s\:\s\[\d+,(?P&amp;lt;conferences&amp;gt;\d+.\d+[^,]),\d+.\d+,(?P&amp;lt;calls&amp;gt;\d+),\d+\]\}"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know if this helps!!&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 11:59:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-extract-2-single-values-from-set-of-numbers/m-p/457062#M171184</guid>
      <dc:creator>deepashri_123</dc:creator>
      <dc:date>2019-05-17T11:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: rex - extract 2 single values from set of numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-extract-2-single-values-from-set-of-numbers/m-p/457063#M171185</link>
      <description>&lt;P&gt;I modified the regex above a little to get the correct fields.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^server:\s\[\w+\]\s:\s{\"\d+\"\s\:\s\[(?P&amp;lt;conferences&amp;gt;\d+),\d+.\d+[^,],\d+.\d+,(?P&amp;lt;calls&amp;gt;\d+),\d+\]\}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you're new to regex, here's a great website to help.  You can use it to try regex expressions and collaborate with others to help you become an expert.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/DAog06/1/"&gt;https://regex101.com/r/DAog06/1/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 12:16:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-extract-2-single-values-from-set-of-numbers/m-p/457063#M171185</guid>
      <dc:creator>memarshall63</dc:creator>
      <dc:date>2019-05-17T12:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: rex - extract 2 single values from set of numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-extract-2-single-values-from-set-of-numbers/m-p/457064#M171186</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval msg="server: [USAGE] : {\"2\" : [23,23.000,89.375,35,0]}
host = us-voice-vmr11.corp.com" 
| append 
    [| makeresults 
    | eval msg="server: [USAGE] : {\"2\" : [1,1.000,16.000,4,0]}
host = gs-voice-vmr12.corp.com"] 
| rex field=msg "^server:\s\[\w+\]\s:\s\{\"\d+\"\s:\s\[(?P&amp;lt;temp&amp;gt;.+)\]}" 
| eval values = split(temp,",") 
| eval conferences = mvindex(values,0) 
| eval calls = mvindex(values,3)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 May 2019 12:24:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-extract-2-single-values-from-set-of-numbers/m-p/457064#M171186</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-05-17T12:24:16Z</dc:date>
    </item>
  </channel>
</rss>

