<?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 to extract multiple same name child attributes from XML data into their own unique fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191128#M55005</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;index=test_orders sourcetype=orderForms
| spath output=VendorName path=OrderForm.ClientOrder.Vendor.Name
| spath output=VendorCity path=OrderForm.ClientOrder.Vendor.Address.City
| spath output=ClientName path=OrderForm.ClientOrder.Client.Name
| spath output=ClientCity path=OrderForm.ClientOrder.Client.Address.City
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 31 Mar 2015 21:34:35 GMT</pubDate>
    <dc:creator>bwheelock</dc:creator>
    <dc:date>2015-03-31T21:34:35Z</dc:date>
    <item>
      <title>How to extract multiple same name child attributes from XML data into their own unique fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191123#M55000</link>
      <description>&lt;P&gt;I have some XML data broken down into events that have multiple child attributes that share the same name but are distinctly different fields. What I need to do, for each event, is to separate each unique child section into their own unique fields. This is probably extremely easy to accomplish, but I cannot seem to figure it out.&lt;/P&gt;

&lt;P&gt;Referencing the sample data below, I need to extract the vendor's information as VendorName, VendorCity, etc and likewise for client and supplier I need ClientName, ClientCity, etc. Auto extraction obviously doesn't work in this case without transforms, and regular expressions are proving to be difficult because the real data has multiple addresses, phone numbers, and/or might lack some of this information. Each XML file (event) has about 100 lines.&lt;/P&gt;

&lt;P&gt;I'm able to get the information easily if I use spath, but I don't think I can use spath for anything but search time extraction by piping it in with the output and path. That's fine for a search or report here or there, but otherwise I'm piping in about 50 lines.&lt;/P&gt;

&lt;P&gt;What am I doing wrong?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;OrderForm&amp;gt;
  &amp;lt;ClientOrder PO="00000123"&amp;gt;
    &amp;lt;Vendor ID="789"&amp;gt;
      &amp;lt;Name&amp;gt;Paperclips, INC&amp;lt;/Name&amp;gt;
      &amp;lt;Address&amp;gt;
        &amp;lt;Street&amp;gt;789 Paper St&amp;lt;/Street&amp;gt;
        &amp;lt;City&amp;gt;San Francisco&amp;lt;/City&amp;gt;
        &amp;lt;State&amp;gt;CA&amp;lt;/State&amp;gt;
        &amp;lt;Zip&amp;gt;84989&amp;lt;/Zip&amp;gt;
      &amp;lt;/Address&amp;gt;
    &amp;lt;/Vendor&amp;gt;
    &amp;lt;Supplier ID="224"&amp;gt;
      &amp;lt;Name&amp;gt;Happy Paper Co.&amp;lt;/Name&amp;gt;
      &amp;lt;Address&amp;gt;
        &amp;lt;Street&amp;gt;12455 Shipping Ave&amp;lt;/Street&amp;gt;
        &amp;lt;City&amp;gt;Los Angeles&amp;lt;/City&amp;gt;
        &amp;lt;State&amp;gt;CA&amp;lt;/State&amp;gt;
        &amp;lt;Zip&amp;gt;92254&amp;lt;/Zip&amp;gt;
      &amp;lt;/Address&amp;gt;
    &amp;lt;/Supplier&amp;gt;
    &amp;lt;Client ID="4152"&amp;gt;
      &amp;lt;Name&amp;gt;Dunder Mifflin Infinity&amp;lt;/Name&amp;gt;
      &amp;lt;Address&amp;gt;
        &amp;lt;Street&amp;gt;1725 Slough Ave&amp;lt;/Street&amp;gt;
        &amp;lt;City&amp;gt;Scranton&amp;lt;/City&amp;gt;
        &amp;lt;State&amp;gt;PA&amp;lt;/State&amp;gt;
        &amp;lt;Zip&amp;gt;18503&amp;lt;/Zip&amp;gt;
      &amp;lt;/Address&amp;gt;
    &amp;lt;/Client&amp;gt;
  &amp;lt;/ClientOrder&amp;gt;
&amp;lt;/OrderForm&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Mar 2015 23:59:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191123#M55000</guid>
      <dc:creator>bwheelock</dc:creator>
      <dc:date>2015-03-20T23:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract multiple same name child attributes from XML data into their own unique fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191124#M55001</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;maybe splitting the XML at the level of "Vendor", "Supplier", "Client" could help. Therefore use the &lt;CODE&gt;BREAK_ONLY_BEFORE&lt;/CODE&gt; in your props.conf:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.2/Admin/propsconf" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.0.2/Admin/propsconf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;with something like this regex:&lt;BR /&gt;
&lt;CODE&gt;BREAK_ONLY_BEFORE = ^\s+\&amp;lt;Vendor ID="\d+"\&amp;gt;|^\s+\&amp;lt;Supplier ID="\d+"\&amp;gt;|^\s+\&amp;lt;Client ID="\d+"\&amp;gt;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You may still have to do "something" with the parts between two &lt;CODE&gt;&amp;lt;OrderForm&amp;gt;&lt;/CODE&gt; Elements (e.g. NULL queue).&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:12:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191124#M55001</guid>
      <dc:creator>bjoernjensen</dc:creator>
      <dc:date>2020-09-28T19:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract multiple same name child attributes from XML data into their own unique fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191125#M55002</link>
      <description>&lt;P&gt;If every XML file is a single event, you may try this props settings:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;LINE_BREAKER = (?!)
SHOULD_LINEMERGE = false
#BREAK_ONLY_BEFORE = &amp;lt;OrderForm&amp;gt;
DATETIME_CONFIG = NONE
LEARN_MODEL = false
#MAX_EVENTS = 200000
TRUNCATE = 0 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let us know what worked for you.&lt;/P&gt;

&lt;P&gt;Mitesh.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Mar 2015 06:25:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191125#M55002</guid>
      <dc:creator>miteshvohra</dc:creator>
      <dc:date>2015-03-22T06:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract multiple same name child attributes from XML data into their own unique fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191126#M55003</link>
      <description>&lt;P&gt;I'd lose the corresponding order ID though, in this case the PO#. &lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2015 17:34:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191126#M55003</guid>
      <dc:creator>bwheelock</dc:creator>
      <dc:date>2015-03-26T17:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract multiple same name child attributes from XML data into their own unique fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191127#M55004</link>
      <description>&lt;P&gt;How can you use Spath to get the  VendorName, VendorCity, etc ? Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2015 21:03:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191127#M55004</guid>
      <dc:creator>anhtran</dc:creator>
      <dc:date>2015-03-31T21:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract multiple same name child attributes from XML data into their own unique fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191128#M55005</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=test_orders sourcetype=orderForms
| spath output=VendorName path=OrderForm.ClientOrder.Vendor.Name
| spath output=VendorCity path=OrderForm.ClientOrder.Vendor.Address.City
| spath output=ClientName path=OrderForm.ClientOrder.Client.Name
| spath output=ClientCity path=OrderForm.ClientOrder.Client.Address.City
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Mar 2015 21:34:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191128#M55005</guid>
      <dc:creator>bwheelock</dc:creator>
      <dc:date>2015-03-31T21:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract multiple same name child attributes from XML data into their own unique fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191129#M55006</link>
      <description>&lt;P&gt;ah, very neat , thank you !&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2015 02:07:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191129#M55006</guid>
      <dc:creator>anhtran</dc:creator>
      <dc:date>2015-04-01T02:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract multiple same name child attributes from XML data into their own unique fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191130#M55007</link>
      <description>&lt;P&gt;Is this solution worked for you ? Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2015 02:17:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-same-name-child-attributes-from-XML-data/m-p/191130#M55007</guid>
      <dc:creator>anhtran</dc:creator>
      <dc:date>2015-04-01T02:17:02Z</dc:date>
    </item>
  </channel>
</rss>

