<?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: Extract multi valued XML field as key/value pairs in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152620#M9322</link>
    <description>&lt;P&gt;In your props.conf do&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetype]
EXTRACT-prsnl_id = (?i)&amp;lt;prsnl_id&amp;gt;(?P&amp;lt;prsnl_id&amp;gt;[^&amp;lt;]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where prsnl_id is the xml tag you would be trying to create the key value pair.&lt;/P&gt;</description>
    <pubDate>Mon, 05 May 2014 19:20:54 GMT</pubDate>
    <dc:creator>antlefebvre</dc:creator>
    <dc:date>2014-05-05T19:20:54Z</dc:date>
    <item>
      <title>Extract multi valued XML field as key/value pairs</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152617#M9319</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have the following XML (the dots are removed parts):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Exception timestamp="05/05/2014 14:25:53" ...&amp;gt;
&amp;lt;StackTrace&amp;gt;
    &amp;lt;Frame exceptionType=...&amp;gt;
        &amp;lt;Context&amp;gt;
            &amp;lt;Data name="Request_ApplicationPath"&amp;gt;the_path&amp;lt;/Data&amp;gt;
            &amp;lt;Data name="Request_Url_AbsoluteUri"&amp;gt;the_url&amp;lt;/Data&amp;gt;
            &amp;lt;Data name="ApplicationName"&amp;gt;the_appname&amp;lt;/Data&amp;gt;
        &amp;lt;/Context&amp;gt;
    &amp;lt;/Frame&amp;gt;
&amp;lt;/StackTrace&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;/P&gt;

&lt;P&gt;How can I get key/value fields as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Request_ApplicationPath = the_path
Request_Url_AbsoluteUri = the_url
ApplicationName = the_appname
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm trying to use spath but all I can get is either the key or the value, not the combination of them as fields.&lt;/P&gt;

&lt;P&gt;Thank you,&lt;/P&gt;

&lt;P&gt;Edit: I was looking for a solution without having to rely on regexes... I'm sorry, I should have mentioned it in the original post.&lt;/P&gt;</description>
      <pubDate>Mon, 05 May 2014 15:25:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152617#M9319</guid>
      <dc:creator>gustavomichels</dc:creator>
      <dc:date>2014-05-05T15:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multi valued XML field as key/value pairs</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152618#M9320</link>
      <description>&lt;P&gt;You can write a props.conf/transforms.conf extraction something like this:&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your_sourcetype]
TRANSFORMS-data = extract_data
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[extract_data]
REGEX = Data\s+name="(?&amp;lt;_KEY_1&amp;gt;[^"])"\s*&amp;gt;(?&amp;lt;_VAL_1&amp;gt;[^&amp;lt;]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.3/Admin/transformsconf"&gt;http://docs.splunk.com/Documentation/Splunk/6.0.3/Admin/transformsconf&lt;/A&gt; for reference, search for &lt;CODE&gt;_KEY_&lt;/CODE&gt;.&lt;BR /&gt;
Note, this makes assumptions about your XML, for example that &lt;CODE&gt;name&lt;/CODE&gt; is the only attribute of the &lt;CODE&gt;Data&lt;/CODE&gt; element.&lt;/P&gt;</description>
      <pubDate>Mon, 05 May 2014 18:31:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152618#M9320</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-05-05T18:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multi valued XML field as key/value pairs</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152619#M9321</link>
      <description>&lt;P&gt;Thanks for your answer.&lt;/P&gt;

&lt;P&gt;I was looking for a solution without having to rely on regexes... I'm sorry, I should have mentioned it in the original post.&lt;/P&gt;</description>
      <pubDate>Mon, 05 May 2014 18:36:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152619#M9321</guid>
      <dc:creator>gustavomichels</dc:creator>
      <dc:date>2014-05-05T18:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multi valued XML field as key/value pairs</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152620#M9322</link>
      <description>&lt;P&gt;In your props.conf do&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetype]
EXTRACT-prsnl_id = (?i)&amp;lt;prsnl_id&amp;gt;(?P&amp;lt;prsnl_id&amp;gt;[^&amp;lt;]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where prsnl_id is the xml tag you would be trying to create the key value pair.&lt;/P&gt;</description>
      <pubDate>Mon, 05 May 2014 19:20:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152620#M9322</guid>
      <dc:creator>antlefebvre</dc:creator>
      <dc:date>2014-05-05T19:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multi valued XML field as key/value pairs</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152621#M9323</link>
      <description>&lt;P&gt;Thanks for your answer.&lt;/P&gt;

&lt;P&gt;I was looking for a solution without having to rely on regexes... I'm sorry, I should have mentioned it in the original post, but it won't let me edit as the captcha always fails.&lt;/P&gt;</description>
      <pubDate>Mon, 05 May 2014 19:33:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152621#M9323</guid>
      <dc:creator>gustavomichels</dc:creator>
      <dc:date>2014-05-05T19:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multi valued XML field as key/value pairs</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152622#M9324</link>
      <description>&lt;P&gt;I've added that to your question.&lt;/P&gt;

&lt;P&gt;Getting field names from your event data without this approach of extracting the field name in transforms.conf isn't going to work. &lt;CODE&gt;spath&lt;/CODE&gt; can extract the name into one field value and the value into another field value, but I don't see a simple way of getting that used as a field name.&lt;/P&gt;</description>
      <pubDate>Mon, 05 May 2014 19:39:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152622#M9324</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-05-05T19:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multi valued XML field as key/value pairs</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152623#M9325</link>
      <description>&lt;P&gt;Did you solve this issue? I have the same challenge right now...&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 18:55:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152623#M9325</guid>
      <dc:creator>tamakg</dc:creator>
      <dc:date>2018-08-24T18:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multi valued XML field as key/value pairs</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152624#M9326</link>
      <description>&lt;P&gt;My suggestion is to clean a bit the xml document, to be something like - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;Exception timestamp="05/05/2014 14:25:53" ...&amp;gt;

   &amp;lt;StackTrace&amp;gt;
      &amp;lt;Frame exceptionType=...&amp;gt;
           &amp;lt;Context&amp;gt;
               &amp;lt;Request_ApplicationPath&amp;gt;the_path&amp;lt;/Request_ApplicationPath&amp;gt;
               &amp;lt;Request_Url_AbsoluteUri&amp;gt;the_url&amp;lt;/Request_Url_AbsoluteUri&amp;gt;
               &amp;lt;ApplicationName&amp;gt;the_appname&amp;lt;/ApplicationName&amp;gt;
           &amp;lt;/Context&amp;gt;
      &amp;lt;/Frame&amp;gt;
 &amp;lt;/StackTrace&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;By using the xml sourcetype, you can reach the xml elements via - &lt;CODE&gt;| spath StackTrace.Frame.Context.Request_ApplicationPath&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Aug 2018 23:55:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-multi-valued-XML-field-as-key-value-pairs/m-p/152624#M9326</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2018-08-25T23:55:49Z</dc:date>
    </item>
  </channel>
</rss>

