<?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: XML Field Extraction -- Multiple Lines in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/XML-Field-Extraction-Multiple-Lines/m-p/58500#M14330</link>
    <description>&lt;P&gt;Good point - I wasn't thinking about the fact that XML is order-independent for subelements.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Mar 2013 18:20:06 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2013-03-12T18:20:06Z</dc:date>
    <item>
      <title>XML Field Extraction -- Multiple Lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/XML-Field-Extraction-Multiple-Lines/m-p/58496#M14326</link>
      <description>&lt;P&gt;I am new to Splunk and have been messing with this for about a week so I am looking to the community to help.  I pretty much have multiple xml errors that I am trying to extract the error code "VOSCM0000I", the severity "Info" and the message "Transaction successful" out of multiple lines over a duration. Top offender over a period of time.&lt;/P&gt;

&lt;P&gt;Any thoughts?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;ResponseMessage&amp;gt;
    &amp;lt;mes:StatusCode&amp;gt;1&amp;lt;/mes:StatusCode&amp;gt;
    &amp;lt;mes:BusinessMessage&amp;gt;
      &amp;lt;mes:Code&amp;gt;VOSCM0000I&amp;lt;/mes:Code&amp;gt;
      &amp;lt;mes:Severity&amp;gt;Info&amp;lt;/mes:Severity&amp;gt;
      &amp;lt;mes:LocalizedMessage&amp;gt;Transaction successful&amp;lt;/mes:LocalizedMessage&amp;gt;
    &amp;lt;/mes:BusinessMessage&amp;gt;
    &amp;lt;mes:BusinessMessage&amp;gt;
      &amp;lt;mes:Code&amp;gt;RENTAL003067&amp;lt;/mes:Code&amp;gt;
      &amp;lt;mes:Severity&amp;gt;Error&amp;lt;/mes:Severity&amp;gt;
      &amp;lt;mes:FieldName&amp;gt;ValidateTicketInput.ticket&amp;lt;/mes:FieldName&amp;gt;
      &amp;lt;mes:LocalizedMessage&amp;gt;Total renter charge amount for this ticket obtained from pricing and payment is not matching.&amp;lt;/mes:LocalizedMessage&amp;gt;
    &amp;lt;/mes:BusinessMessage&amp;gt;
  &amp;lt;/ResponseMessage&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Mar 2013 13:21:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/XML-Field-Extraction-Multiple-Lines/m-p/58496#M14326</guid>
      <dc:creator>ksimpkins</dc:creator>
      <dc:date>2013-03-12T13:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: XML Field Extraction -- Multiple Lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/XML-Field-Extraction-Multiple-Lines/m-p/58497#M14327</link>
      <description>&lt;P&gt;For the extraction spath is your friend:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...  | spath output=msg path=ResponseMessage.mes:BusinessMessage | mvexpand msg | spath input=msg output=Code path=mes:Code | and so on
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Mar 2013 16:24:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/XML-Field-Extraction-Multiple-Lines/m-p/58497#M14327</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-03-12T16:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: XML Field Extraction -- Multiple Lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/XML-Field-Extraction-Multiple-Lines/m-p/58498#M14328</link>
      <description>&lt;P&gt;I like Martin's solution, but I would finish it differently. Either should work, though.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| spath output=msg path=ResponseMessage.mes:BusinessMessage 
| mvexpand msg
| rex "(?m)mes\:Code\&amp;gt;(?&amp;lt;Code&amp;gt;.*?)\&amp;lt;.*?mes\:Severity\&amp;gt;(?&amp;lt;Severity&amp;gt;.*?)\&amp;lt;.*?mes\:LocalizedMessage\&amp;gt;(?&amp;lt;Message&amp;gt;.*?)\&amp;lt;"
| top Code Severity Message
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Mar 2013 17:02:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/XML-Field-Extraction-Multiple-Lines/m-p/58498#M14328</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-03-12T17:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: XML Field Extraction -- Multiple Lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/XML-Field-Extraction-Multiple-Lines/m-p/58499#M14329</link>
      <description>&lt;P&gt;An upside to the spath way is that it ignores different orderings and allows for optional elements without mucking up the regular expression - if for instance there were events with no localized message the expression would not match at all.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2013 17:07:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/XML-Field-Extraction-Multiple-Lines/m-p/58499#M14329</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-03-12T17:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: XML Field Extraction -- Multiple Lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/XML-Field-Extraction-Multiple-Lines/m-p/58500#M14330</link>
      <description>&lt;P&gt;Good point - I wasn't thinking about the fact that XML is order-independent for subelements.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2013 18:20:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/XML-Field-Extraction-Multiple-Lines/m-p/58500#M14330</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-03-12T18:20:06Z</dc:date>
    </item>
  </channel>
</rss>

