<?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: xmlkv  How does it work? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-does-xmlkv-work/m-p/21008#M3095</link>
    <description>&lt;P&gt;&lt;CODE&gt;xmlkv&lt;/CODE&gt; looks for values inside tags of the form &lt;CODE&gt;&amp;lt;fieldname&amp;gt;value&amp;lt;/fieldname&amp;gt;&lt;/CODE&gt;. Each time it finds that pattern it sets an extracted field to that value.&lt;/P&gt;

&lt;P&gt;If there are multiple keys with the same name, the value of the last one will be used. Note that &lt;CODE&gt;value&lt;/CODE&gt; may be an empty string, in which case the field will be set to null and may not appear in the list.&lt;/P&gt;

&lt;P&gt;For your example, you should see an additional field in the field picker named &lt;B&gt;&lt;CODE&gt;a&lt;/CODE&gt;&lt;/B&gt;, containing a value of &lt;B&gt;&lt;CODE&gt;3&lt;/CODE&gt;&lt;/B&gt;.&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
&lt;CODE&gt;xmlkv&lt;/CODE&gt; is actually a python-based command in the search app, so you can look at the source code in &lt;CODE&gt;apps/search/bin/xmlkv.py&lt;/CODE&gt; if you're so inclined.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jan 2011 09:28:41 GMT</pubDate>
    <dc:creator>southeringtonp</dc:creator>
    <dc:date>2011-01-06T09:28:41Z</dc:date>
    <item>
      <title>How does xmlkv work?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-does-xmlkv-work/m-p/21007#M3094</link>
      <description>&lt;P&gt;All of our data is in XML format that is being indexed. I've been able to pull out a lot of extractions for single value attributes or element values.&lt;/P&gt;
&lt;P&gt;However I've yet to be able to figure out how to deal with multivalue xpaths. I've tried using xmlkv but there is little to no documentation in the Splunk documentation and answers.splunk.com.&lt;/P&gt;
&lt;P&gt;IE:&lt;/P&gt;
&lt;P&gt;&amp;lt;a&amp;gt;1&amp;lt;/a&amp;gt;&amp;lt;a&amp;gt;2&amp;lt;/a&amp;gt;&amp;lt;a&amp;gt;3&amp;lt;/a&amp;gt;&lt;/P&gt;
&lt;P&gt;I want a field or fields pulled out with a certain name for the values 1,2 and 3. xmlkv doesn't seem to do anything. How can I get the values 1,2 and 3 pulled out into a field?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 15:10:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-does-xmlkv-work/m-p/21007#M3094</guid>
      <dc:creator>Zambonilli</dc:creator>
      <dc:date>2022-12-19T15:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: xmlkv  How does it work?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-does-xmlkv-work/m-p/21008#M3095</link>
      <description>&lt;P&gt;&lt;CODE&gt;xmlkv&lt;/CODE&gt; looks for values inside tags of the form &lt;CODE&gt;&amp;lt;fieldname&amp;gt;value&amp;lt;/fieldname&amp;gt;&lt;/CODE&gt;. Each time it finds that pattern it sets an extracted field to that value.&lt;/P&gt;

&lt;P&gt;If there are multiple keys with the same name, the value of the last one will be used. Note that &lt;CODE&gt;value&lt;/CODE&gt; may be an empty string, in which case the field will be set to null and may not appear in the list.&lt;/P&gt;

&lt;P&gt;For your example, you should see an additional field in the field picker named &lt;B&gt;&lt;CODE&gt;a&lt;/CODE&gt;&lt;/B&gt;, containing a value of &lt;B&gt;&lt;CODE&gt;3&lt;/CODE&gt;&lt;/B&gt;.&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
&lt;CODE&gt;xmlkv&lt;/CODE&gt; is actually a python-based command in the search app, so you can look at the source code in &lt;CODE&gt;apps/search/bin/xmlkv.py&lt;/CODE&gt; if you're so inclined.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jan 2011 09:28:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-does-xmlkv-work/m-p/21008#M3095</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2011-01-06T09:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: xmlkv  How does it work?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-does-xmlkv-work/m-p/21009#M3096</link>
      <description>&lt;P&gt;To add to what sotheringtop said, you can aways make a copy of the "xmlkv.py" script and make it multi-value aware so that "a" is returned as a muli-value field that contains [ 1, 2, 3 ].&lt;/P&gt;

&lt;P&gt;But on second thought, it may be easier to just do this with a transformer like so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[xmlkv_multivalue]
REGEX = &amp;lt;(.*?)(?:\s[^&amp;gt;]*)?&amp;gt;([^&amp;lt;]*)&amp;lt;/\\1&amp;gt;
FORMAT = $1::$2
MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So instead of adding &lt;CODE&gt;| xmlkv&lt;/CODE&gt; to you search, add &lt;CODE&gt;| extract xmlkv_multivalue&lt;/CODE&gt; and see if that gets you what you want.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jan 2011 09:47:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-does-xmlkv-work/m-p/21009#M3096</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2011-01-06T09:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: xmlkv  How does it work?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-does-xmlkv-work/m-p/21010#M3097</link>
      <description>&lt;P&gt;Thank you for responding so quickly and with fantastic descriptions. &lt;/P&gt;

&lt;P&gt;At this point I've extracted the parent element of the "a" elements and do searches with preceding and trailing *.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2011 03:06:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-does-xmlkv-work/m-p/21010#M3097</guid>
      <dc:creator>Zambonilli</dc:creator>
      <dc:date>2011-01-07T03:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: xmlkv  How does it work?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-does-xmlkv-work/m-p/21011#M3098</link>
      <description>&lt;P&gt;Agreed - this is a better way.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2011 10:33:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-does-xmlkv-work/m-p/21011#M3098</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2011-01-07T10:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: xmlkv  How does it work?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-does-xmlkv-work/m-p/624621#M107368</link>
      <description>&lt;P&gt;|spath handles both JSON and XML.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|makeresults |eval _raw="&amp;lt;a&amp;gt;1&amp;lt;/a&amp;gt;&amp;lt;a&amp;gt;2&amp;lt;/a&amp;gt;&amp;lt;a&amp;gt;3&amp;lt;/a&amp;gt;" |spath path=a output=a&lt;/LI-CODE&gt;&lt;P&gt;...or just&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|makeresults  |eval _raw="&amp;lt;a&amp;gt;1&amp;lt;/a&amp;gt;&amp;lt;a&amp;gt;2&amp;lt;/a&amp;gt;&amp;lt;a&amp;gt;3&amp;lt;/a&amp;gt;" |spath&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Dec 2022 00:11:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-does-xmlkv-work/m-p/624621#M107368</guid>
      <dc:creator>scombs</dc:creator>
      <dc:date>2022-12-17T00:11:57Z</dc:date>
    </item>
  </channel>
</rss>

