<?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 break the XML file into multiple events from search head? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458763#M168092</link>
    <description>&lt;P&gt;Thanks Niket,&lt;/P&gt;

&lt;P&gt;I don't it's getting replacing with blank place.&lt;BR /&gt;
But Example is -&lt;BR /&gt;
t1 tag  start&lt;BR /&gt;
t1 tag end &lt;BR /&gt;
t2 tag  start&lt;BR /&gt;
t2 tag end &lt;BR /&gt;
t2 tag  start&lt;BR /&gt;
t2 tag end &lt;BR /&gt;
t2 tag  start&lt;BR /&gt;
t2 tag end &lt;BR /&gt;
t3 tag  start&lt;BR /&gt;
t3  tag end &lt;/P&gt;</description>
    <pubDate>Fri, 27 Jul 2018 11:08:29 GMT</pubDate>
    <dc:creator>nasrinmulani</dc:creator>
    <dc:date>2018-07-27T11:08:29Z</dc:date>
    <item>
      <title>How to break the XML file into multiple events from search head?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458761#M168090</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I have indexed the XML file without breaking it into events, I need to break the events using on tag. Hence can i achieve this using the search head?&lt;BR /&gt;
Example&lt;/P&gt;

&lt;P&gt;I need to break the events by tag, so that i can fetch the details in each  tag as each row.&lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 06:36:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458761#M168090</guid>
      <dc:creator>nasrinmulani</dc:creator>
      <dc:date>2018-07-27T06:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to break the XML file into multiple events from search head?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458762#M168091</link>
      <description>&lt;P&gt;@nasrinmulani I think you have missed the example. Please mock/anonymize any sensitive data before posting.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 06:51:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458762#M168091</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-07-27T06:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to break the XML file into multiple events from search head?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458763#M168092</link>
      <description>&lt;P&gt;Thanks Niket,&lt;/P&gt;

&lt;P&gt;I don't it's getting replacing with blank place.&lt;BR /&gt;
But Example is -&lt;BR /&gt;
t1 tag  start&lt;BR /&gt;
t1 tag end &lt;BR /&gt;
t2 tag  start&lt;BR /&gt;
t2 tag end &lt;BR /&gt;
t2 tag  start&lt;BR /&gt;
t2 tag end &lt;BR /&gt;
t2 tag  start&lt;BR /&gt;
t2 tag end &lt;BR /&gt;
t3 tag  start&lt;BR /&gt;
t3  tag end &lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 11:08:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458763#M168092</guid>
      <dc:creator>nasrinmulani</dc:creator>
      <dc:date>2018-07-27T11:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to break the XML file into multiple events from search head?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458764#M168093</link>
      <description>&lt;P&gt;I don't know it's getting  replaced by blank place&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 11:09:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458764#M168093</guid>
      <dc:creator>nasrinmulani</dc:creator>
      <dc:date>2018-07-27T11:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to break the XML file into multiple events from search head?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458765#M168094</link>
      <description>&lt;P&gt;In the text editor for putting your question theres a little picture of some 1s and zeroes. It will open a code box you can paste your xml in there&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 14:05:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458765#M168094</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2018-07-27T14:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to break the XML file into multiple events from search head?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458766#M168095</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Head&amp;gt;
&amp;lt;Detail&amp;gt;
&amp;lt;id&amp;gt;123&amp;lt;/id&amp;gt;
&amp;lt;Name&amp;gt;x&amp;lt;/Name&amp;gt;
&amp;lt;/Detail&amp;gt;
&amp;lt;/Head&amp;gt;
&amp;lt;Head&amp;gt;
&amp;lt;Detail&amp;gt;
&amp;lt;id&amp;gt;1234&amp;lt;/id&amp;gt;
&amp;lt;Name&amp;gt;y&amp;lt;/Name&amp;gt;
&amp;lt;/Detail&amp;gt;
&amp;lt;/Head&amp;gt;
&amp;lt;Head&amp;gt;
&amp;lt;Detail&amp;gt;
&amp;lt;id&amp;gt;12347&amp;lt;/id&amp;gt;
&amp;lt;Name&amp;gt;y&amp;lt;/Name&amp;gt;
&amp;lt;/Detail&amp;gt;
&amp;lt;/Head&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Jul 2018 05:58:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458766#M168095</guid>
      <dc:creator>nasrinmulani</dc:creator>
      <dc:date>2018-07-31T05:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to break the XML file into multiple events from search head?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458767#M168096</link>
      <description>&lt;P&gt;I want to break this into multiple events, it is not a single event.&lt;BR /&gt;
I want break it through  tag but in search head.&lt;/P&gt;

&lt;P&gt;Is there any SPL command to break the events from search head?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 06:00:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458767#M168096</guid>
      <dc:creator>nasrinmulani</dc:creator>
      <dc:date>2018-07-31T06:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to break the XML file into multiple events from search head?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458768#M168097</link>
      <description>&lt;P&gt;@nasrinmulani, please try the following two options with run anywhere examples:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Option 1: Using &lt;CODE&gt;spath&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="&amp;lt;Head&amp;gt;
 &amp;lt;Detail&amp;gt;
 &amp;lt;id&amp;gt;123&amp;lt;/id&amp;gt;
 &amp;lt;Name&amp;gt;x&amp;lt;/Name&amp;gt;
 &amp;lt;/Detail&amp;gt;
 &amp;lt;/Head&amp;gt;
 &amp;lt;Head&amp;gt;
 &amp;lt;Detail&amp;gt;
 &amp;lt;id&amp;gt;1234&amp;lt;/id&amp;gt;
 &amp;lt;Name&amp;gt;y&amp;lt;/Name&amp;gt;
 &amp;lt;/Detail&amp;gt;
 &amp;lt;/Head&amp;gt;
 &amp;lt;Head&amp;gt;
 &amp;lt;Detail&amp;gt;
 &amp;lt;id&amp;gt;12347&amp;lt;/id&amp;gt;
 &amp;lt;Name&amp;gt;y&amp;lt;/Name&amp;gt;
 &amp;lt;/Detail&amp;gt;
 &amp;lt;/Head&amp;gt;"
| spath
| fields - _*
| rename "Head.Detail.*" as "*"
| eval data=mvzip(id,Name)
| fields data
| mvexpand data
| makemv data delim=","
| eval id=mvindex(data,0), Name=mvindex(data,1)
| fields - data
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Option 2: Using rex command&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="&amp;lt;Head&amp;gt;
 &amp;lt;Detail&amp;gt;
 &amp;lt;id&amp;gt;123&amp;lt;/id&amp;gt;
 &amp;lt;Name&amp;gt;x&amp;lt;/Name&amp;gt;
 &amp;lt;/Detail&amp;gt;
 &amp;lt;/Head&amp;gt;
 &amp;lt;Head&amp;gt;
 &amp;lt;Detail&amp;gt;
 &amp;lt;id&amp;gt;1234&amp;lt;/id&amp;gt;
 &amp;lt;Name&amp;gt;y&amp;lt;/Name&amp;gt;
 &amp;lt;/Detail&amp;gt;
 &amp;lt;/Head&amp;gt;
 &amp;lt;Head&amp;gt;
 &amp;lt;Detail&amp;gt;
 &amp;lt;id&amp;gt;12347&amp;lt;/id&amp;gt;
 &amp;lt;Name&amp;gt;y&amp;lt;/Name&amp;gt;
 &amp;lt;/Detail&amp;gt;
 &amp;lt;/Head&amp;gt;"
| rex "(?ms)(?&amp;lt;Detail&amp;gt;\&amp;lt;Detail\&amp;gt;.*?\&amp;lt;\/Detail\&amp;gt;)" max_match=0
| fields - _*
| mvexpand Detail
| rename Detail as _raw
| spath
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: First two pipes i.e. &lt;CODE&gt;| makeresults&lt;/CODE&gt; and  &lt;CODE&gt;| eval _raw ....&lt;/CODE&gt; generate sample event as per the question. You should use your own base search instead of these to test with your data.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 06:15:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458768#M168097</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-07-31T06:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to break the XML file into multiple events from search head?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458769#M168098</link>
      <description>&lt;P&gt;As an extra note, unless your XML will always have the same structure, use &lt;CODE&gt;| spath&lt;/CODE&gt; (IE Option 1)  instead of rex to extract the fields. &lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 08:16:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458769#M168098</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2018-07-31T08:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to break the XML file into multiple events from search head?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458770#M168099</link>
      <description>&lt;P&gt;Look into using spath within an eval statement, if you find the spath command is slow. We found that rewriting spath to using spath within an eval, and the occasional rex, is much faster. Use the job inspector to measure your results.&lt;/P&gt;

&lt;P&gt;Note it was a lot of work to rewrite the command into eval and rex, but for as often as we needed it, for the amount of data we needed it for, it was worth the effort. YMMV.&lt;/P&gt;

&lt;P&gt;The Doc for Eval: &lt;A href="http://docs.splunk.com/Documentation/Splunk/7.1.2/SearchReference/CommonEvalFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/7.1.2/SearchReference/CommonEvalFunctions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;From that page:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;spath(X,Y)    Extracts a value from a&lt;BR /&gt;
structured data type (XML or JSON) in&lt;BR /&gt;
X based on a location path in Y.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Tue, 31 Jul 2018 12:52:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458770#M168099</guid>
      <dc:creator>efavreau</dc:creator>
      <dc:date>2018-07-31T12:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to break the XML file into multiple events from search head?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458771#M168100</link>
      <description>&lt;P&gt;Thanks!! It was helpful for me, but now i am thinking to break it via props.conf itself.&lt;BR /&gt;
I got one issue that my log events are breaking in between, may it's because of  larger size of records so it's truncating it.&lt;/P&gt;

&lt;P&gt;Any one know about the breaking of file. I am trying with&lt;BR /&gt;
BREAK_ONLY_BEFORE=&lt;BR /&gt;
MUST_BREAK_AFTER=&amp;lt;\/Detail&amp;gt;&lt;/P&gt;

&lt;P&gt;let's see if it works.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:47:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458771#M168100</guid>
      <dc:creator>nasrinmulani</dc:creator>
      <dc:date>2020-09-29T20:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to break the XML file into multiple events from search head?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458772#M168101</link>
      <description>&lt;P&gt;Change the TRUNCATE limit as per your data refer more options for Event Breaking: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Data/Configureeventlinebreaking"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Data/Configureeventlinebreaking&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Test with some of the xml data for which it is not working in Preview mode with sample data.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Aug 2018 15:10:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-the-XML-file-into-multiple-events-from-search-head/m-p/458772#M168101</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-08-04T15:10:15Z</dc:date>
    </item>
  </channel>
</rss>

