<?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: Multivalue xml field extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370865#M169819</link>
    <description>&lt;P&gt;Ok. Thanks !!&lt;/P&gt;</description>
    <pubDate>Mon, 30 Apr 2018 11:21:17 GMT</pubDate>
    <dc:creator>jsanjeb</dc:creator>
    <dc:date>2018-04-30T11:21:17Z</dc:date>
    <item>
      <title>Multivalue xml field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370857#M169811</link>
      <description>&lt;P&gt;Hi Splunkers,&lt;/P&gt;

&lt;P&gt;Part of the incoming xml data looks like this,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;metaDataSet&amp;gt;
            &amp;lt;metaData key="DocName"&amp;gt;mm1266505-20180330195251.txt&amp;lt;/metaData&amp;gt;
            &amp;lt;metaData key="TARGET"&amp;gt;Brazil BES&amp;lt;/metaData&amp;gt;
            &amp;lt;metaData key="com.ibm.wmqfte.OriginatingUser"&amp;gt;eimb@CORPWEB&amp;lt;/metaData&amp;gt;
            &amp;lt;metaData key="com.ibm.wmqfte.OriginatingHost"&amp;gt;B051S317.jci.com&amp;lt;/metaData&amp;gt;
            &amp;lt;metaData key="com.ibm.wmqfte.TransferId"&amp;gt;414d512050445053514d513031202020770fbe5aacf88f20&amp;lt;/metaData&amp;gt;
            &amp;lt;metaData key="com.ibm.wmqfte.Priority"&amp;gt;0&amp;lt;/metaData&amp;gt;
        &amp;lt;/metaDataSet&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need extract the field key which is multi-valued. Current regex will extract only the first matching pattern. Please help with the regex.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 08:36:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370857#M169811</guid>
      <dc:creator>jsanjeb</dc:creator>
      <dc:date>2018-04-30T08:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue xml field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370858#M169812</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;

&lt;P&gt;a proper regex would be  &lt;CODE&gt;\skey="([^"]+)"&lt;/CODE&gt;.&lt;BR /&gt;
Put it in your transforms, set &lt;CODE&gt;MV_ADD = true&lt;/CODE&gt;, and you should be good.&lt;/P&gt;

&lt;P&gt;However, this might be helpful, too: &lt;CODE&gt;&amp;lt;metaData\s+key="([^"]+)"&amp;gt;((?!&amp;lt;\/metaData&amp;gt;).+)&amp;lt;\/metaData&amp;gt;&lt;/CODE&gt;&lt;BR /&gt;
You could then set &lt;CODE&gt;FORMAT = $1::$2&lt;/CODE&gt; so you get fields corresponding with the key names and their proper values.&lt;/P&gt;

&lt;P&gt;You could also do both, like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;props.conf&lt;/CODE&gt;&lt;BR /&gt;
[your-sourcetype]&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REPORT-metadata-fields = metadata-keys-mv-field, metadata-key-value-fields
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;transforms.conf&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[metadata-keys-mv-field]
REGEX = &amp;lt;metaData\s+key="(?&amp;lt;metadata_keys&amp;gt;[^"]+)"
MV_ADD = true

[metadata-key-value-fields]
REGEX = &amp;lt;metaData\s+key="([^"]+)"&amp;gt;((?!&amp;lt;\/metaData&amp;gt;).+)&amp;lt;\/metaData&amp;gt;
FORMAT = $1::$2
MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope that helps - if it does I'd be happy if you would upvote/accept this answer, so others could profit from it. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 08:59:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370858#M169812</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-04-30T08:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue xml field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370859#M169813</link>
      <description>&lt;P&gt;Hi xpac, thanks for response. I am working on Splunk cloud. Will i be able to add these extraction through UI?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 09:09:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370859#M169813</guid>
      <dc:creator>jsanjeb</dc:creator>
      <dc:date>2018-04-30T09:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue xml field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370860#M169814</link>
      <description>&lt;P&gt;I've no experience on Splunk Cloud, but on a on premise installation, you would have to do it via config files - no way to do this via the GUI. So unless Splunk Cloud doesn't offer something special for this case, I guess your way is through support then.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 09:14:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370860#M169814</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-04-30T09:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue xml field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370861#M169815</link>
      <description>&lt;P&gt;I tried in cloud, field extraction is working perfectly . Thanks !! but looks like the second transform which maps values is not working. When I search a metadata_key with its values in a query it is not giving me results.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 10:21:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370861#M169815</guid>
      <dc:creator>jsanjeb</dc:creator>
      <dc:date>2018-04-30T10:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue xml field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370862#M169816</link>
      <description>&lt;P&gt;Did you add it via GUI? The &lt;CODE&gt;FORMAT = $1::$2&lt;/CODE&gt; is essential, else it will most likely not return anything.&lt;BR /&gt;
I tried that regex here with your sample data, so at least the regex should be fine:&lt;BR /&gt;
&lt;A href="https://regex101.com/r/5JcfIv/1"&gt;https://regex101.com/r/5JcfIv/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 10:25:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370862#M169816</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-04-30T10:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue xml field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370863#M169817</link>
      <description>&lt;P&gt;Yes I have added it via GUI. I have added FORMAT = $1::$2 as well. Regex is perfectly fine.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 10:30:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370863#M169817</guid>
      <dc:creator>jsanjeb</dc:creator>
      <dc:date>2018-04-30T10:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue xml field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370864#M169818</link>
      <description>&lt;P&gt;Ah, didn't know it was possible, rarely use the GUI. I fear without actual access troubleshooting this is difficult - maybe you can find any errors in &lt;CODE&gt;index=_internal&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 10:34:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370864#M169818</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-04-30T10:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue xml field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370865#M169819</link>
      <description>&lt;P&gt;Ok. Thanks !!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 11:21:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalue-xml-field-extraction/m-p/370865#M169819</guid>
      <dc:creator>jsanjeb</dc:creator>
      <dc:date>2018-04-30T11:21:17Z</dc:date>
    </item>
  </channel>
</rss>

