<?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 Multi value event merging and breaking in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Multi-value-event-merging-and-breaking/m-p/154495#M43446</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;

&lt;P&gt;I am trying working out a scenario with Splunk and having a hard time on it.&lt;/P&gt;

&lt;P&gt;I have got a XML which has the order number in it. I need to do everything at search time. &lt;/P&gt;

&lt;P&gt;Example XPATH: //OrderNumber (the number of occurrence is one only in whole XML)&lt;BR /&gt;
Then I am pulling out all the sub orders inside this order by using XPATH= //OrderNumber/SubOrderNumber ( this is dynamic - which means it can have more than 1 occurrences)&lt;BR /&gt;
Then I am also looking for there statuses in the XML against the SubOrderNumber using XPATH= //OrderNumber/SubOrderNumberSTATUS ( this is dynamic - which means it can have more than 1 occurrences but it may be less or more than the sub order numbers)&lt;/P&gt;

&lt;P&gt;Now the problem is that all these fields are pulled out quite well but they all are in single event.&lt;/P&gt;

&lt;P&gt;Results:-&lt;/P&gt;

&lt;HR /&gt;

&lt;H2&gt;Event 1:&lt;/H2&gt;

&lt;PRE&gt;&lt;CODE&gt;OrderNumber SubOrderNumber  SubOrderNumberStatus
12345        12345-1         Open
             12345-2         Closed
             12345-3        
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I want to see the output as individual events , something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;OrderNumber SubOrderNumber  SubOrderNumberStatus
12345        12345-1         Open
12345        12345-2         Closed
12345        12345-3         {leave it blank}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The above should be 3 different events.&lt;/P&gt;

&lt;P&gt;I tried using the below query which works fine if all the fields have some data :-&lt;/P&gt;

&lt;P&gt;| fields OrderNumber SubOrderNumber SubOrderNumberStatus&lt;BR /&gt;
|eval fields=mvzip(OrderNumber,SubOrderNumber) | mvexpand fields | eval temp=split(fields,",") | eval OrderNumber_new =mvindex(temp,0)|eval SubOrderNumber_new =mvindex(temp,1)| table OrderNumber_new, SubOrderNumber_new&lt;/P&gt;

&lt;P&gt;Can anyone please provide some pointer around it.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 15:54:58 GMT</pubDate>
    <dc:creator>ramanjain1983</dc:creator>
    <dc:date>2020-09-28T15:54:58Z</dc:date>
    <item>
      <title>Multi value event merging and breaking</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-value-event-merging-and-breaking/m-p/154495#M43446</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;

&lt;P&gt;I am trying working out a scenario with Splunk and having a hard time on it.&lt;/P&gt;

&lt;P&gt;I have got a XML which has the order number in it. I need to do everything at search time. &lt;/P&gt;

&lt;P&gt;Example XPATH: //OrderNumber (the number of occurrence is one only in whole XML)&lt;BR /&gt;
Then I am pulling out all the sub orders inside this order by using XPATH= //OrderNumber/SubOrderNumber ( this is dynamic - which means it can have more than 1 occurrences)&lt;BR /&gt;
Then I am also looking for there statuses in the XML against the SubOrderNumber using XPATH= //OrderNumber/SubOrderNumberSTATUS ( this is dynamic - which means it can have more than 1 occurrences but it may be less or more than the sub order numbers)&lt;/P&gt;

&lt;P&gt;Now the problem is that all these fields are pulled out quite well but they all are in single event.&lt;/P&gt;

&lt;P&gt;Results:-&lt;/P&gt;

&lt;HR /&gt;

&lt;H2&gt;Event 1:&lt;/H2&gt;

&lt;PRE&gt;&lt;CODE&gt;OrderNumber SubOrderNumber  SubOrderNumberStatus
12345        12345-1         Open
             12345-2         Closed
             12345-3        
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I want to see the output as individual events , something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;OrderNumber SubOrderNumber  SubOrderNumberStatus
12345        12345-1         Open
12345        12345-2         Closed
12345        12345-3         {leave it blank}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The above should be 3 different events.&lt;/P&gt;

&lt;P&gt;I tried using the below query which works fine if all the fields have some data :-&lt;/P&gt;

&lt;P&gt;| fields OrderNumber SubOrderNumber SubOrderNumberStatus&lt;BR /&gt;
|eval fields=mvzip(OrderNumber,SubOrderNumber) | mvexpand fields | eval temp=split(fields,",") | eval OrderNumber_new =mvindex(temp,0)|eval SubOrderNumber_new =mvindex(temp,1)| table OrderNumber_new, SubOrderNumber_new&lt;/P&gt;

&lt;P&gt;Can anyone please provide some pointer around it.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:54:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-value-event-merging-and-breaking/m-p/154495#M43446</guid>
      <dc:creator>ramanjain1983</dc:creator>
      <dc:date>2020-09-28T15:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Multi value event merging and breaking</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-value-event-merging-and-breaking/m-p/154496#M43447</link>
      <description>&lt;P&gt;Easy this one!&lt;BR /&gt;
I was unnecessarily complicating it by using mvzip. &lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2014 00:17:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-value-event-merging-and-breaking/m-p/154496#M43447</guid>
      <dc:creator>ramanjain1983</dc:creator>
      <dc:date>2014-02-19T00:17:54Z</dc:date>
    </item>
  </channel>
</rss>

