<?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 How can I split an event into two or more events according to two multivalue fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-an-event-into-two-or-more-events-according-to/m-p/175119#M50250</link>
    <description>&lt;P&gt;The raw data is like :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;FieldA | FieldB | FieldC | FieldD
14-51-P-1216;14-52-P-0258;14-52-P-0053;14-52-P-0054 | 99DF-E8FF-DA0F-5F6D;1B33-9DAE-7B47-A7B4;FCFF-8F4A-106F-5894;5864-CDA1-7400-AD33 | 2015-07-14 | 2015-11-13
14-50-L-0892;14-50-L-0891 | E934-DD3D-86C9-1D5B;F64B-3125-1D75-1D53 | 2015-08-14 | 2015-09-01
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;FieldA &amp;amp; FieldB are both multivalue fields, and how many values of one field is indefinite.&lt;BR /&gt;
But, there is a one - to - one relationship between the two fields.&lt;/P&gt;

&lt;P&gt;I want to split the two events into 6 events as listed below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;FieldA | FieldB | FieldC | FieldD
14-51-P-1216 | 99DF-E8FF-DA0F-5F6D | 2015-07-14 | 2015-11-13
14-52-P-0258 | 1B33-9DAE-7B47-A7B4 | 2015-07-14 | 2015-11-13
14-52-P-0053 | FCFF-8F4A-106F-5894 | 2015-07-14 | 2015-11-13
14-52-P-0054 | 5864-CDA1-7400-AD33 | 2015-07-14 | 2015-11-13
14-50-L-0892 | E934-DD3D-86C9-1D5B | 2015-08-14 | 2015-09-01
14-50-L-0891 | F64B-3125-1D75-1D53 | 2015-08-14 | 2015-09-01
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 15 Aug 2015 06:19:09 GMT</pubDate>
    <dc:creator>caili</dc:creator>
    <dc:date>2015-08-15T06:19:09Z</dc:date>
    <item>
      <title>How can I split an event into two or more events according to two multivalue fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-an-event-into-two-or-more-events-according-to/m-p/175119#M50250</link>
      <description>&lt;P&gt;The raw data is like :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;FieldA | FieldB | FieldC | FieldD
14-51-P-1216;14-52-P-0258;14-52-P-0053;14-52-P-0054 | 99DF-E8FF-DA0F-5F6D;1B33-9DAE-7B47-A7B4;FCFF-8F4A-106F-5894;5864-CDA1-7400-AD33 | 2015-07-14 | 2015-11-13
14-50-L-0892;14-50-L-0891 | E934-DD3D-86C9-1D5B;F64B-3125-1D75-1D53 | 2015-08-14 | 2015-09-01
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;FieldA &amp;amp; FieldB are both multivalue fields, and how many values of one field is indefinite.&lt;BR /&gt;
But, there is a one - to - one relationship between the two fields.&lt;/P&gt;

&lt;P&gt;I want to split the two events into 6 events as listed below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;FieldA | FieldB | FieldC | FieldD
14-51-P-1216 | 99DF-E8FF-DA0F-5F6D | 2015-07-14 | 2015-11-13
14-52-P-0258 | 1B33-9DAE-7B47-A7B4 | 2015-07-14 | 2015-11-13
14-52-P-0053 | FCFF-8F4A-106F-5894 | 2015-07-14 | 2015-11-13
14-52-P-0054 | 5864-CDA1-7400-AD33 | 2015-07-14 | 2015-11-13
14-50-L-0892 | E934-DD3D-86C9-1D5B | 2015-08-14 | 2015-09-01
14-50-L-0891 | F64B-3125-1D75-1D53 | 2015-08-14 | 2015-09-01
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 15 Aug 2015 06:19:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-an-event-into-two-or-more-events-according-to/m-p/175119#M50250</guid>
      <dc:creator>caili</dc:creator>
      <dc:date>2015-08-15T06:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split an event into two or more events according to two multivalue fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-an-event-into-two-or-more-events-according-to/m-p/175120#M50251</link>
      <description>&lt;P&gt;I think you might be interested in a search using a bunch of &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.5/SearchReference/CommonEvalFunctions#Multivalue_functions"&gt;multivalue eval functions&lt;/A&gt; like this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;base search to retrieve data&amp;gt;
| eval FieldA=split(FieldA,";")
| eval FieldB=split(FieldB,";")
| eval FieldAB=mvzip(FieldA,FieldB,":")
| mvexpand FieldAB
| eval FieldAB=split(FieldAB,":")
| eval FieldA=mvindex(FieldAB,0)
| eval FieldB=mvindex(FieldAB,1)
| fields - FieldAB
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here, I'm assuming FieldA and FieldB start out as single string fields with semicolon delimiters, so first we turn them into multivalued fields by splitting on their semicolons. Next we create a new multivalued field, FieldAB, by zipping each corresponding pair of values from FieldA and FieldB (with a colon delimiter, change this as appropriate for your data). With this new field, applying &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.5/SearchReference/mvexpand"&gt;mvexpand&lt;/A&gt; works as we expect it to. We then turn each FieldAB value into a multivalued field again (splitting on our previously decided delimiter, and pulling FieldA and FieldB back out.&lt;BR /&gt;
Finally we use &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.5/SearchReference/fields"&gt;fields&lt;/A&gt; to get rid of our temporary field. (but many other commands could work in place here)&lt;/P&gt;</description>
      <pubDate>Sat, 15 Aug 2015 06:37:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-an-event-into-two-or-more-events-according-to/m-p/175120#M50251</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2015-08-15T06:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split an event into two or more events according to two multivalue fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-an-event-into-two-or-more-events-according-to/m-p/175121#M50252</link>
      <description>&lt;P&gt;The SPL search command is so powerful that can handle so complex problems. Thanks very much~&lt;/P&gt;</description>
      <pubDate>Sat, 15 Aug 2015 08:45:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-an-event-into-two-or-more-events-according-to/m-p/175121#M50252</guid>
      <dc:creator>caili</dc:creator>
      <dc:date>2015-08-15T08:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split an event into two or more events according to two multivalue fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-an-event-into-two-or-more-events-according-to/m-p/175122#M50253</link>
      <description>&lt;P&gt;Is there anybody else who can help me ?&lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2015 09:42:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-an-event-into-two-or-more-events-according-to/m-p/175122#M50253</guid>
      <dc:creator>caili</dc:creator>
      <dc:date>2015-08-19T09:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split an event into two or more events according to two multivalue fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-an-event-into-two-or-more-events-according-to/m-p/175123#M50254</link>
      <description>&lt;P&gt;@caili - There are lots of folks who can help you around. Just start a new question for your new issue.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2015 13:07:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-an-event-into-two-or-more-events-according-to/m-p/175123#M50254</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2015-08-19T13:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split an event into two or more events according to two multivalue fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-an-event-into-two-or-more-events-according-to/m-p/175124#M50255</link>
      <description>&lt;P&gt;Thanks very much. I'm so sorry that I had posted my comment in the wrong place.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2015 04:08:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-split-an-event-into-two-or-more-events-according-to/m-p/175124#M50255</guid>
      <dc:creator>caili</dc:creator>
      <dc:date>2015-08-26T04:08:22Z</dc:date>
    </item>
  </channel>
</rss>

