<?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 configure Splunk to read XML files correctly? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-read-XML-files-correctly/m-p/142995#M29216</link>
    <description>&lt;P&gt;Thank you Iguinn &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Dec 2014 13:26:20 GMT</pubDate>
    <dc:creator>oflyt</dc:creator>
    <dc:date>2014-12-12T13:26:20Z</dc:date>
    <item>
      <title>How to configure Splunk to read XML files correctly?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-read-XML-files-correctly/m-p/142991#M29212</link>
      <description>&lt;P&gt;I got a problem getting splunk to read my XML files correctly.&lt;BR /&gt;
Example on one of my XML files:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://imgur.com/RTlYiLy"&gt;http://imgur.com/RTlYiLy&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I want splunk to create a event for every row(the element)&lt;BR /&gt;
and every event should contain information on which &lt;BR /&gt;
table it's from. I've tried to do this in some different ways&lt;BR /&gt;
but none seem to affect splunk.&lt;BR /&gt;
My latest attempt was to edit props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[xml-too_small]
 DATETIME_CONFIG = CURRENT
 KV_MODE = xml
 SHOULD_LINEMERGE = True
 BREAK_ONLY_BEFORE = row(surrounded with &amp;lt;&amp;gt;)// Had problems writing html tags 
MUST_BREAK_AFTER = table(surrounded with &amp;lt;&amp;gt;) | /row(surrounded with &amp;lt;&amp;gt;)
 TRUNCATE = 0
 FIELDALIAS-rootfields = table{@name} as Table table.row{@name} as Row table.row.value{@name} as Valuename table.row.value as Value
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and to add queue = parsingQueue in inputs.conf.&lt;/P&gt;

&lt;P&gt;Thank you! &lt;BR /&gt;
Darlynna&lt;/P&gt;</description>
      <pubDate>Thu, 04 Dec 2014 13:45:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-read-XML-files-correctly/m-p/142991#M29212</guid>
      <dc:creator>darlynna</dc:creator>
      <dc:date>2014-12-04T13:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure Splunk to read XML files correctly?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-read-XML-files-correctly/m-p/142992#M29213</link>
      <description>&lt;P&gt;At index time, Splitting each row as separate event will be easy but adding the table name would be tough (at least I don't way to do that yet). Any chance you can exclude this requirement?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Dec 2014 21:49:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-read-XML-files-correctly/m-p/142992#M29213</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-12-04T21:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure Splunk to read XML files correctly?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-read-XML-files-correctly/m-p/142993#M29214</link>
      <description>&lt;P&gt;The file also has the name of the table, maybe it would ,be easier to make use of that? &lt;span class="lia-unicode-emoji" title=":winking_face_with_tongue:"&gt;😜&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2014 09:26:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-read-XML-files-correctly/m-p/142993#M29214</guid>
      <dc:creator>oflyt</dc:creator>
      <dc:date>2014-12-05T09:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure Splunk to read XML files correctly?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-read-XML-files-correctly/m-p/142994#M29215</link>
      <description>&lt;P&gt;You could do this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[myXML]
DATETIME_CONFIG = CURRENT
KV_MODE = xml
SHOULD_LINEMERGE = True
BREAK_ONLY_BEFORE = \&amp;lt;row&amp;gt;
TRUNCATE = 0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will give you one event per row element. However, there is no way to add in the &lt;CODE&gt;table&lt;/CODE&gt; info. A couple of tips:&lt;BR /&gt;&lt;BR /&gt;
If you specify &lt;CODE&gt;BREAK_ONLY_BEFORE&lt;/CODE&gt;, then you shouldn't specify any other breaking criteria.&lt;BR /&gt;&lt;BR /&gt;
The &lt;CODE&gt;&amp;lt;&lt;/CODE&gt; is a special character in regular expressions. You should really escape it with a &lt;CODE&gt;\&lt;/CODE&gt; as I did, although I think Splunk may not require this.&lt;BR /&gt;&lt;BR /&gt;
Unless you have some compelling reason (which you need to explain), you should &lt;EM&gt;not&lt;/EM&gt; specify the parsingQueue.&lt;/P&gt;

&lt;P&gt;If the source file name contains the name of the table, I would &lt;STRONG&gt;definitely&lt;/STRONG&gt; use that. Keep the same props.conf as above, but add one more line:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TRANSFORMS-myxml=extract-table-name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and create &lt;CODE&gt;transforms.conf&lt;/CODE&gt; like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[extract-table-name]
SOURCE_KEY=MetaData:Source
REGEX=firstpartoffilename(\S+?)\.xml
FORMAT=table::$1
WRITE_META = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that you will need to change the REGEX so that it picks up the actual name of the table from the filename. This creates an index-time field; although I usually dislike index-time fields, this is a case where it may be needed.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Dec 2014 18:01:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-read-XML-files-correctly/m-p/142994#M29215</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-12-06T18:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure Splunk to read XML files correctly?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-read-XML-files-correctly/m-p/142995#M29216</link>
      <description>&lt;P&gt;Thank you Iguinn &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2014 13:26:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-read-XML-files-correctly/m-p/142995#M29216</guid>
      <dc:creator>oflyt</dc:creator>
      <dc:date>2014-12-12T13:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure Splunk to read XML files correctly?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-read-XML-files-correctly/m-p/142996#M29217</link>
      <description>&lt;P&gt;Huge thanks!:)&lt;/P&gt;</description>
      <pubDate>Mon, 15 Dec 2014 05:47:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-read-XML-files-correctly/m-p/142996#M29217</guid>
      <dc:creator>darlynna</dc:creator>
      <dc:date>2014-12-15T05:47:15Z</dc:date>
    </item>
  </channel>
</rss>

