<?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: Expand two multi value field with different format using mvexpand in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Expand-two-multi-value-field-with-different-format-using/m-p/479389#M134365</link>
    <description>&lt;P&gt;@ahmadshakir1952&lt;BR /&gt;
Can you please share sample events from both sourcetype? So I can help you design search.&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jan 2020 06:43:14 GMT</pubDate>
    <dc:creator>kamlesh_vaghela</dc:creator>
    <dc:date>2020-01-07T06:43:14Z</dc:date>
    <item>
      <title>Expand two multi value field with different format using mvexpand</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expand-two-multi-value-field-with-different-format-using/m-p/479384#M134360</link>
      <description>&lt;P&gt;Trying to expand two multi value field using mvexpand for below scenario: &lt;/P&gt;

&lt;P&gt;Jhon purchased Mango and Banana both. &lt;BR /&gt;
Colins purchased Papaya and Brad purchased Apple. &lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8180i615D7D001A59D314/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;My current output not showing Apple is purchased by Brad. &lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8181i8104622FBC95A6A8/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Part of code for expanding used as below: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table Name,Fruit | eval sample = mvzip(Name,Fruit) | mvexpand sample | makemv sample delim="," | eval Name=mvindex(sample,0)| eval Fruit=mvindex(sample,1) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please help to get the desired output as per last picture. &lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2020 09:44:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expand-two-multi-value-field-with-different-format-using/m-p/479384#M134360</guid>
      <dc:creator>ahmadshakir1952</dc:creator>
      <dc:date>2020-01-06T09:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: Expand two multi value field with different format using mvexpand</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expand-two-multi-value-field-with-different-format-using/m-p/479385#M134361</link>
      <description>&lt;P&gt;@ahmadshakir1952 &lt;/P&gt;

&lt;P&gt;Your posted images not providing proper information regarding field type and so on. So can you please provide some sample events OR images from Splunk search?&lt;/P&gt;

&lt;P&gt;Meanwhile check below thing also..&lt;/P&gt;

&lt;P&gt;The value of &lt;CODE&gt;Fruit&lt;/CODE&gt; field against &lt;CODE&gt;name&lt;/CODE&gt; Jhon is multivalued? Like output of below search?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval name="Jhon|Colins|Brad",friuts="Mango#Banana|Papaya|Apple", name=split(name,"|"),friuts=split(friuts,"|") , tmp=mvzip(name,friuts) 
| mvexpand tmp 
| eval name=mvindex(split(tmp,","),0),friuts=mvindex(split(tmp,","),1),friuts=split(friuts,"#")
| rename COMMENT as "This is sample of your search" 
| table name friuts
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then try to append &lt;CODE&gt;| mvexpand friuts&lt;/CODE&gt; .&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2020 12:29:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expand-two-multi-value-field-with-different-format-using/m-p/479385#M134361</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2020-01-06T12:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: Expand two multi value field with different format using mvexpand</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expand-two-multi-value-field-with-different-format-using/m-p/479386#M134362</link>
      <description>&lt;P&gt;UPDATED:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval Name=split("Jhon,Colins,Brad",",") 
| eval Fruit=split("Mango,Banana,Papaya,Apple",",") 
| eval field_x=split("eat,like,love,taste",",") 
| eval field_y=split("one,two",",") 
| fields - _time 
| rename COMMENT as "this is sample data you provided" 
| rename COMMENT as "From here, the logic" 
| eval _counter=mvrange(0,mvcount(Fruit)) 
| eval Name = mvappend(mvindex(Name,0),Name) 
| stats list(*) as * by _counter
| foreach * 
    [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = case(mvcount(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;) = 2, mvindex(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;,_counter % 2),true(),mvindex(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;,_counter))] 
| fields Name field_x field_y Fruit
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, @ahmadshakir1952&lt;BR /&gt;
I don't use &lt;CODE&gt;mvexpand&lt;/CODE&gt;.&lt;BR /&gt;
but How about this?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2020 12:30:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expand-two-multi-value-field-with-different-format-using/m-p/479386#M134362</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-06T12:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Expand two multi value field with different format using mvexpand</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expand-two-multi-value-field-with-different-format-using/m-p/479387#M134363</link>
      <description>&lt;P&gt;Name and Fruit both are from different sourectype , but they both sharing a common ID field. In here example, Jhon is multi-valued and In name column its not certain which value is going to be multivalue in Fruit column/field. &lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 02:42:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expand-two-multi-value-field-with-different-format-using/m-p/479387#M134363</guid>
      <dc:creator>ahmadshakir1952</dc:creator>
      <dc:date>2020-01-07T02:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: Expand two multi value field with different format using mvexpand</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expand-two-multi-value-field-with-different-format-using/m-p/479388#M134364</link>
      <description>&lt;P&gt;Here i have given example of two filed. Can you please for 2 more fields which is also multi-valued. i.e: field name: field_x and field_y then what would be the for each condition. &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:36:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expand-two-multi-value-field-with-different-format-using/m-p/479388#M134364</guid>
      <dc:creator>ahmadshakir1952</dc:creator>
      <dc:date>2020-09-30T03:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Expand two multi value field with different format using mvexpand</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expand-two-multi-value-field-with-different-format-using/m-p/479389#M134365</link>
      <description>&lt;P&gt;@ahmadshakir1952&lt;BR /&gt;
Can you please share sample events from both sourcetype? So I can help you design search.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 06:43:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expand-two-multi-value-field-with-different-format-using/m-p/479389#M134365</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2020-01-07T06:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: Expand two multi value field with different format using mvexpand</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expand-two-multi-value-field-with-different-format-using/m-p/479390#M134366</link>
      <description>&lt;P&gt;Hi @ahmadshakir1952 &lt;BR /&gt;
My answer updated. please confirm.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 11:44:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expand-two-multi-value-field-with-different-format-using/m-p/479390#M134366</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-07T11:44:46Z</dc:date>
    </item>
  </channel>
</rss>

