<?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 can I extract a multi value field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484736#M135683</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 temp="IP-Group={xxxx} {yyyy} {zzz}" 
| rex field=temp max_match=0 "\{(?P&amp;lt;result&amp;gt;[^}]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 14 Nov 2019 03:45:14 GMT</pubDate>
    <dc:creator>vnravikumar</dc:creator>
    <dc:date>2019-11-14T03:45:14Z</dc:date>
    <item>
      <title>How can I extract a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484726#M135673</link>
      <description>&lt;P&gt;We have a field called &lt;CODE&gt;IP-Group&lt;/CODE&gt;. It can be empty or it would have this format - &lt;CODE&gt;IP-Group={xxxx} {yyyy} {zzz}&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Can I extract it until the last &lt;CODE&gt;}&lt;/CODE&gt; and maybe extract each value separately as well? &lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 14:39:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484726#M135673</guid>
      <dc:creator>danielbb</dc:creator>
      <dc:date>2019-11-13T14:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484727#M135674</link>
      <description>&lt;P&gt;The following does it - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval xx="IP-Group={xxxx} {yyyy} {zzz}" 
| rex field=xx "IP-Group=(?&amp;lt;yy&amp;gt;.+\})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But can we generate a distinct field for each value?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 15:15:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484727#M135674</guid>
      <dc:creator>danielbb</dc:creator>
      <dc:date>2019-11-13T15:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484728#M135675</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval xx="IP-Group={xxxx} {yyyy} {zzz}" 
| rex field=xx "IP-Group=\{(?&amp;lt;x&amp;gt;[^\}]+)\}\s+\{(?&amp;lt;y&amp;gt;[^\}]+)\}\s+\{(?&amp;lt;z&amp;gt;[^\}]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Nov 2019 15:22:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484728#M135675</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-11-13T15:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484729#M135676</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
please try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval IP-Group="{ip1} {ip2} {ip3} {ip4}"|makemv delim=" " IP-Group | mvexpand IP-Group | rex field=IP-Group "\{(?&amp;lt;ipvalue&amp;gt;.*)\}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You want to have one event per ip value, because the length of your list is dynamic and there is no other way that comes to my mind to parse a variable number of values from a list.&lt;BR /&gt;
Hope it helps&lt;BR /&gt;
Oliver&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 15:23:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484729#M135676</guid>
      <dc:creator>ololdach</dc:creator>
      <dc:date>2019-11-13T15:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484730#M135677</link>
      <description>&lt;P&gt;Distinct fields as in, ipgroup1=xxx, ipgroup2=yyy, ipgroup3=zzz?&lt;/P&gt;

&lt;P&gt;If the actual number of items in the multivalued field is dynamic, that is going to be pretty difficult to solve elegantly.&lt;/P&gt;

&lt;P&gt;If the number of possible entries is somewhat limited (e.g. max 3) you can do it like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=xx "IP-Group=\{(?&amp;lt;ipgroup1&amp;gt;[^}]+)\}(?:\s+\{(?&amp;lt;ipgroup2&amp;gt;[^}]+)\})?(?:\s+\{(?&amp;lt;ipgroup3&amp;gt;[^}]+)\})?"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See: &lt;A href="https://regex101.com/r/RSfFlu/1"&gt;https://regex101.com/r/RSfFlu/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;This approach can be extended as far as you want, by just appending more &lt;CODE&gt;(?:\s+\{(?&amp;lt;ipgroup...&amp;gt;[^}]+)\})?&lt;/CODE&gt; parts. But that gets a bit ugly if it can also be 100 entries.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 15:24:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484730#M135677</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-11-13T15:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484731#M135678</link>
      <description>&lt;P&gt;I get *&lt;EM&gt;Unbalanced quotes. *&lt;/EM&gt; on that.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 15:36:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484731#M135678</guid>
      <dc:creator>danielbb</dc:creator>
      <dc:date>2019-11-13T15:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484732#M135679</link>
      <description>&lt;P&gt;&lt;CODE&gt;"\{(?&amp;lt;ipvalue&amp;gt;.*)\}"&lt;/CODE&gt; change&lt;BR /&gt;
add &lt;CODE&gt;"&lt;/CODE&gt; at the end&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 15:46:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484732#M135679</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-11-13T15:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484733#M135680</link>
      <description>&lt;P&gt;Great! looks good.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 16:37:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484733#M135680</guid>
      <dc:creator>danielbb</dc:creator>
      <dc:date>2019-11-13T16:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484734#M135681</link>
      <description>&lt;P&gt;If you are ingesting structured data like JSON or XML, then you can use set kvmode in props.conf for automatic kv field extraction.&lt;BR /&gt;
I've not personally used it for JSON, but I do use it for XML and it works like a champ, including multi-value fields.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.0/Knowledge/Automatickey-valuefieldextractionsatsearch-time"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.0/Knowledge/Automatickey-valuefieldextractionsatsearch-time&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 16:54:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484734#M135681</guid>
      <dc:creator>codebuilder</dc:creator>
      <dc:date>2019-11-13T16:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484735#M135682</link>
      <description>&lt;P&gt;Sorry, cut &amp;amp; paste error &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; forgot to paste the final "&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 18:46:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484735#M135682</guid>
      <dc:creator>ololdach</dc:creator>
      <dc:date>2019-11-13T18:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484736#M135683</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 temp="IP-Group={xxxx} {yyyy} {zzz}" 
| rex field=temp max_match=0 "\{(?P&amp;lt;result&amp;gt;[^}]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Nov 2019 03:45:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484736#M135683</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-11-14T03:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484737#M135684</link>
      <description>&lt;P&gt;Great - this is slick!!! &lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 14:35:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-a-multi-value-field/m-p/484737#M135684</guid>
      <dc:creator>danielbb</dc:creator>
      <dc:date>2019-11-14T14:35:10Z</dc:date>
    </item>
  </channel>
</rss>

