<?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 do I extract an XML payload from a Java CXF LoggingInInterceptor log entry? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117595#M6779</link>
    <description>&lt;P&gt;The format for a single log entry is as you see above (starts with date and ends with a dashed line) and contains line breaks, even between XML elements.&lt;/P&gt;

&lt;P&gt;In addition, there are XML namespaces and prefixes in some of the XML elements such as &lt;A href="soap:Body"&gt;soap:Body&lt;/A&gt; -- when I tried substituting the SOAP body with &lt;PAYLOAD&gt; Splunk returns an error indicating that there is a missing terminator. I assume the ':' needs to be escaped somehow?&lt;/PAYLOAD&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Jun 2014 14:13:53 GMT</pubDate>
    <dc:creator>sjnorman</dc:creator>
    <dc:date>2014-06-25T14:13:53Z</dc:date>
    <item>
      <title>How do I extract an XML payload from a Java CXF LoggingInInterceptor log entry?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117591#M6775</link>
      <description>&lt;P&gt;Our application is using CXF interceptors to log XML SOAP requests and responses. The format of the log entries is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2014-06-24 07:35:03,597 INFO  com.foo.bar.Test WebContainer : 5 - Inbound Message
 ---------------------------
ID: 7232  
Response-Code: 200  
Encoding: UTF-8  
Content-Type: text/xml  
Headers: {$WSCS=[RC4-MD5], $WSIS=[true], ...  
Payload: &amp;lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&amp;gt;&amp;lt;soap:Body&amp;gt;&amp;lt;MyXmlMessage&amp;gt;....&amp;lt;/MyXmlMessage&amp;gt;&amp;lt;/soap:Body&amp;gt;&amp;lt;/soap:Envelope&amp;gt;
 --------------------------------------
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there any way to have Splunk (whether through configuration, a search query, etc.) extract the XML payload part of the log entry? We'd like to be able to run queries against the XML to look for specific element values.&lt;/P&gt;

&lt;P&gt;In case it makes a difference, the SOAP payload log entries are intermixed with other application-specific log entries.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jun 2014 13:13:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117591#M6775</guid>
      <dc:creator>sjnorman</dc:creator>
      <dc:date>2014-06-24T13:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract an XML payload from a Java CXF LoggingInInterceptor log entry?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117592#M6776</link>
      <description>&lt;P&gt;Once you've extracted the XML string into the &lt;CODE&gt;Payload&lt;/CODE&gt; field you could do this in a search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | spath input=Payload
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That'll look at the content of &lt;CODE&gt;Payload&lt;/CODE&gt; and extract all fields it can find. If you're looking for a specific value only you can add an xpath-style selector as well, see &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.1/SearchReference/spath"&gt;http://docs.splunk.com/Documentation/Splunk/6.1.1/SearchReference/spath&lt;/A&gt; for reference.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jun 2014 13:20:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117592#M6776</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-06-24T13:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract an XML payload from a Java CXF LoggingInInterceptor log entry?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117593#M6777</link>
      <description>&lt;P&gt;Thanks...just need to find out &lt;EM&gt;how&lt;/EM&gt; to get the Payload field extracted first.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jun 2014 13:25:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117593#M6777</guid>
      <dc:creator>sjnorman</dc:creator>
      <dc:date>2014-06-24T13:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract an XML payload from a Java CXF LoggingInInterceptor log entry?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117594#M6778</link>
      <description>&lt;P&gt;That shouldn't be a problem. Add a field extraction with this expression:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Payload: (?&amp;lt;Payload&amp;gt;[^\n\r]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That's assuming your XML has no line breaks. To test you can use inline &lt;CODE&gt;rex&lt;/CODE&gt; like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "Payload: (?&amp;lt;Payload&amp;gt;[^\n\r]+)" | spath input=Payload
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Jun 2014 13:44:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117594#M6778</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-06-24T13:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract an XML payload from a Java CXF LoggingInInterceptor log entry?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117595#M6779</link>
      <description>&lt;P&gt;The format for a single log entry is as you see above (starts with date and ends with a dashed line) and contains line breaks, even between XML elements.&lt;/P&gt;

&lt;P&gt;In addition, there are XML namespaces and prefixes in some of the XML elements such as &lt;A href="soap:Body"&gt;soap:Body&lt;/A&gt; -- when I tried substituting the SOAP body with &lt;PAYLOAD&gt; Splunk returns an error indicating that there is a missing terminator. I assume the ':' needs to be escaped somehow?&lt;/PAYLOAD&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jun 2014 14:13:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117595#M6779</guid>
      <dc:creator>sjnorman</dc:creator>
      <dc:date>2014-06-25T14:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract an XML payload from a Java CXF LoggingInInterceptor log entry?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117596#M6780</link>
      <description>&lt;P&gt;Splunk will eat that. Look at this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | eval _raw = "2014-06-24 07:35:03,597 INFO  com.foo.bar.Test WebContainer : 5 - Inbound Message
 ---------------------------
ID: 7232  
Response-Code: 200  
Encoding: UTF-8  
Content-Type: text/xml  
Headers: {$WSCS=[RC4-MD5], $WSIS=[true], ...  
Payload: &amp;lt;soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"&amp;gt;&amp;lt;soap:Body&amp;gt;&amp;lt;MyXmlMessage&amp;gt;....&amp;lt;/MyXmlMessage&amp;gt;&amp;lt;/soap:Body&amp;gt;&amp;lt;/soap:Envelope&amp;gt;
 --------------------------------------"
| rex "(?s)Payload: (?&amp;lt;payload&amp;gt;.*)\s+-{30,}" | spath input=payload
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Jun 2014 21:44:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117596#M6780</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-06-25T21:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract an XML payload from a Java CXF LoggingInInterceptor log entry?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117597#M6781</link>
      <description>&lt;P&gt;That'll create a field called &lt;CODE&gt;soap:Envelope.soap:Body.MyXmlMessage&lt;/CODE&gt; with the value &lt;CODE&gt;....&lt;/CODE&gt;, just as you'd expect.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jun 2014 21:45:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117597#M6781</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-06-25T21:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract an XML payload from a Java CXF LoggingInInterceptor log entry?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117598#M6782</link>
      <description>&lt;P&gt;Works, thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jun 2014 18:26:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-extract-an-XML-payload-from-a-Java-CXF/m-p/117598#M6782</guid>
      <dc:creator>sjnorman</dc:creator>
      <dc:date>2014-06-26T18:26:25Z</dc:date>
    </item>
  </channel>
</rss>

