<?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: Search XML data inside Text File in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-XML-data-inside-Text-File/m-p/94459#M24359</link>
    <description>&lt;P&gt;Thanks for quick response. I am new to Splunk so not sure how to check what Splunk uses for line breaking. Is their a way to check &lt;/P&gt;

&lt;P&gt;I am also not sure in my sample if all is being considered as single event. Please tell me how to check it.&lt;/P&gt;

&lt;P&gt;Please let me know how to write regular expression to look over multilines or single line event&lt;/P&gt;

&lt;P&gt;Thanks for helping&lt;/P&gt;</description>
    <pubDate>Mon, 29 Nov 2010 07:45:15 GMT</pubDate>
    <dc:creator>bansi</dc:creator>
    <dc:date>2010-11-29T07:45:15Z</dc:date>
    <item>
      <title>Search XML data inside Text File</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-XML-data-inside-Text-File/m-p/94457#M24357</link>
      <description>&lt;P&gt;The Log file fed to splunk  is  a *.txt i.e. Text file but it has XML data inside it as shown below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2010-11-17 12:59:24,617 [main] DEBUG splunk - marshallObjectToXml; 
&amp;lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&amp;gt;
&amp;lt;EventLogData xmlns="http:/xyz/EventLogData"&amp;gt;
&amp;lt;Data screen-name="ScottTiger"&amp;gt;
&amp;lt;DataNode node-type="Contract"&amp;gt;
&amp;lt;TransactionAttributes&amp;gt;
&amp;lt;entry key="CONTRACT_ID"&amp;gt;contract1_100&amp;lt;/entry&amp;gt;
&amp;lt;entry key="MEMBER_ID"&amp;gt;Admin1_100&amp;lt;/entry&amp;gt;
&amp;lt;/TransactionAttributes&amp;gt;
&amp;lt;/DataNode&amp;gt;
&amp;lt;/Data&amp;gt;
&amp;lt;/EventLogData&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am unable to extract the value of CONTRACT_ID using XPATH or rex or xmlkv.
Nothing Works !!!
Wondering this might be due to XML embedded inside the text file. 
I am also not sure how Events are formed !!!&lt;/P&gt;

&lt;P&gt;Any pointers/suggestions will be greatly appreciated&lt;/P&gt;</description>
      <pubDate>Thu, 25 Nov 2010 03:12:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-XML-data-inside-Text-File/m-p/94457#M24357</guid>
      <dc:creator>bansi</dc:creator>
      <dc:date>2010-11-25T03:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: Search XML data inside Text File</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-XML-data-inside-Text-File/m-p/94458#M24358</link>
      <description>&lt;P&gt;The first thing I would look at is the line breaking...  Is your sample all being considered a single event?  If so, you should (at least) get rex to find this.  Make sure your regular expression is set to look over multilines (?m).&lt;/P&gt;</description>
      <pubDate>Thu, 25 Nov 2010 10:58:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-XML-data-inside-Text-File/m-p/94458#M24358</guid>
      <dc:creator>bfaber</dc:creator>
      <dc:date>2010-11-25T10:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Search XML data inside Text File</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-XML-data-inside-Text-File/m-p/94459#M24359</link>
      <description>&lt;P&gt;Thanks for quick response. I am new to Splunk so not sure how to check what Splunk uses for line breaking. Is their a way to check &lt;/P&gt;

&lt;P&gt;I am also not sure in my sample if all is being considered as single event. Please tell me how to check it.&lt;/P&gt;

&lt;P&gt;Please let me know how to write regular expression to look over multilines or single line event&lt;/P&gt;

&lt;P&gt;Thanks for helping&lt;/P&gt;</description>
      <pubDate>Mon, 29 Nov 2010 07:45:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-XML-data-inside-Text-File/m-p/94459#M24359</guid>
      <dc:creator>bansi</dc:creator>
      <dc:date>2010-11-29T07:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Search XML data inside Text File</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-XML-data-inside-Text-File/m-p/94460#M24360</link>
      <description>&lt;P&gt;Basically my question in above post is "How to Search/Extract XML Node-Attribute Values?"
For example in my case i would like to extract the Attribute Value of CONTRACT_ID from the below xml snippet&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;entry&amp;gt; key="CONTRACT_ID"&amp;gt;contract1_100&amp;lt;/entry&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please note my attempts to search/extract CONTRACT_ID Value using XPATH from "DATA_NODE" or through rex is not working&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;DataNode&amp;gt; node-type="Contract"&amp;gt;
&amp;lt;TransactionAttributes&amp;gt;
&amp;lt;entry&amp;gt; key="CONTRACT_ID"&amp;gt;contract1_100&amp;lt;/entry&amp;gt;
&amp;lt;entry&amp;gt; key="MEMBER_ID"&amp;gt;Admin1_100&amp;lt;/entry&amp;gt;
&amp;lt;/TransactionAttributes&amp;gt;
&amp;lt;/DataNode&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please let me know the rex or XPATH to extract CONTRACT_ID value&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2010 03:27:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-XML-data-inside-Text-File/m-p/94460#M24360</guid>
      <dc:creator>bansi</dc:creator>
      <dc:date>2010-11-30T03:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Search XML data inside Text File</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-XML-data-inside-Text-File/m-p/94461#M24361</link>
      <description>&lt;P&gt;xmlkv only seems to extract values if the event is valid xml.  I recreated your problem, and the linebreaking is not the issue.&lt;/P&gt;

&lt;P&gt;One ugly solution is to extract out the xml with a regex and then call xmlkv...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "(?s)(?&amp;lt;xml&amp;gt;&amp;lt;EventLogData.*&amp;lt;/EventLogData&amp;gt;)" | rename _raw as raw | xmlkv | rename raw as _raw 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Feb 2011 01:35:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-XML-data-inside-Text-File/m-p/94461#M24361</guid>
      <dc:creator>carasso</dc:creator>
      <dc:date>2011-02-02T01:35:24Z</dc:date>
    </item>
  </channel>
</rss>

