<?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 merge rows with a common field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-rows-with-a-common-field/m-p/439711#M125071</link>
    <description>&lt;P&gt;I prefer not to use join due performance issues. Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 14 Mar 2019 14:46:59 GMT</pubDate>
    <dc:creator>ndaniel88</dc:creator>
    <dc:date>2019-03-14T14:46:59Z</dc:date>
    <item>
      <title>How to merge rows with a common field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-rows-with-a-common-field/m-p/439706#M125066</link>
      <description>&lt;P&gt;Hello, I have 1 single table that comes from two different searches/indexes/sourcetypes using append.&lt;/P&gt;

&lt;P&gt;I need to join the results using 1 common field (name), in order to have per row all the information that I need.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;The table I have is like:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;+--------+--------+--------+------+----------+&lt;BR /&gt;
| Date1  | Date2  | Date3  | name | Doc |&lt;BR /&gt;
+--------+--------+--------+------+----------+&lt;BR /&gt;
| Jan 08 |------- | --------- |  A1   |----------|&lt;BR /&gt;
| Jan 08 |------- | --------- |  A2   |----------|&lt;BR /&gt;
| Jan 08 |------- | --------- |  A2   |----------|&lt;BR /&gt;
| Jan 08 |------- | --------- |  A3   |----------|&lt;BR /&gt;
| Jan 08 |------- | --------- |  A3   |----------|&lt;BR /&gt;
| Jan 08 |------- | --------- |  A3   |----------|&lt;BR /&gt;
| Jan 08 |------- | --------- |  A3   |----------|&lt;BR /&gt;
| Jan 08 |------- | --------- |  A3   |----------|&lt;BR /&gt;
| Jan 08 |------- | --------- |  A3   |----------|&lt;BR /&gt;
| Jan 04 |------- | --------- |  A4   |----------|&lt;BR /&gt;
| Jan 09 |------- | --------- |  A2   |----------|&lt;BR /&gt;
|-----------| Jan2 | Jan09 | B1   | KYOM     |&lt;BR /&gt;
|-----------| Jan2 | Jan09 | A4   | UNYT     |&lt;BR /&gt;
|-----------| Jan2 | Jan09 | A1   | AGHY     |&lt;BR /&gt;
|-----------| Jan2 | Jan09 | A3   | POLK     |&lt;BR /&gt;
|-----------| Jan2 | Jan09 | B2   | TYHU     |&lt;BR /&gt;
+--------+--------+--------+------+----------+&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;And my goal is to end up with something like&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;+--------+---------+---------+--------+------+&lt;BR /&gt;
| Date1  |  Date2  |  Date3  |  name  |  Doc |&lt;BR /&gt;
+--------+---------+---------+--------+------+&lt;BR /&gt;
| Jan 08 | Jan2    | Jan09   | A1     | AGHY |&lt;BR /&gt;
| Jan 08 | Jan2    | Jan09   | A2     |----------|&lt;BR /&gt;
| Jan 08 | Jan2    | Jan09   | A2     |----------|&lt;BR /&gt;
| Jan 08 | Jan2    | Jan09   | A3     | POLK |&lt;BR /&gt;
| Jan 08 | Jan2    | Jan09   | A3     | POLK |&lt;BR /&gt;
| Jan 08 | Jan2    | Jan09   | A3     | POLK |&lt;BR /&gt;
| Jan 08 | Jan2    | Jan09   | A3     | POLK |&lt;BR /&gt;
| Jan 08 | Jan2    | Jan09   | A3     | POLK |&lt;BR /&gt;
| Jan 08 | Jan2    | Jan09   | A3     | POLK |&lt;BR /&gt;
| Jan 04 | Jan2    | Jan09   | A4     | UNYT |&lt;BR /&gt;
| Jan 09 | Jan2    | Jan09   | A2     |----------|&lt;BR /&gt;
|----------| Jan2    | Jan09   | B1     | KYOM |&lt;BR /&gt;
|----------| Jan2    | Jan09   | B2     | TYHU |&lt;BR /&gt;
+--------+---------+---------+--------+------+&lt;/P&gt;

&lt;P&gt;There is 1 and only 1 common field in the two searches, in the example the date match but is only for testing, it really never match. My search is like:&lt;/P&gt;

&lt;P&gt;index=main sourcetype=test | many | many | many | condition &lt;BR /&gt;
| append [search index=other | many | more | conditions]&lt;/P&gt;

&lt;P&gt;I'm not using a single stats because it groups same name in 1 row (multivalue), and I need each result on its own row. Even tho they have same name, they are different events, that I'll evaluate per row after this table is generated. &lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 18:49:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-rows-with-a-common-field/m-p/439706#M125066</guid>
      <dc:creator>ndaniel88</dc:creator>
      <dc:date>2019-03-13T18:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge rows with a common field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-rows-with-a-common-field/m-p/439707#M125067</link>
      <description>&lt;P&gt;You say you don't want to use a single stats, but have you tried doing so and then using &lt;CODE&gt;mvexpand&lt;/CODE&gt; to put each result in its own row?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 23:42:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-rows-with-a-common-field/m-p/439707#M125067</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-03-13T23:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge rows with a common field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-rows-with-a-common-field/m-p/439708#M125068</link>
      <description>&lt;P&gt;That's the thing, I don't know how to do so. I've tried m expand, but I guess I didn't do it correctly, I don't know how to use it to achieve my goal. &lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 00:47:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-rows-with-a-common-field/m-p/439708#M125068</guid>
      <dc:creator>ndaniel88</dc:creator>
      <dc:date>2019-03-14T00:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge rows with a common field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-rows-with-a-common-field/m-p/439709#M125069</link>
      <description>&lt;P&gt;Try it. "join" use &lt;/P&gt;

&lt;P&gt;index=main &lt;BR /&gt;
| stats count by  Date1 , Date2, Date3 , name , Doc &lt;BR /&gt;
| join type=outer name  [search index=other &lt;BR /&gt;
| stats count by  Date1 , Date2, Date3 , name , Doc ]&lt;BR /&gt;
| table Date1 , Date2, Date3 , name , Doc&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 01:01:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-rows-with-a-common-field/m-p/439709#M125069</guid>
      <dc:creator>moonmk</dc:creator>
      <dc:date>2019-03-14T01:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge rows with a common field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-rows-with-a-common-field/m-p/439710#M125070</link>
      <description>&lt;P&gt;I think the example is strange ...&lt;/P&gt;

&lt;P&gt;If you concatenate Doc using name to data that Doc does not exist&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(your search)
|streamstats count as no|eval no=if(isnull(Doc),0,no)
|stats list(*) as * by name
|fillnull value="" 
|mvexpand Date1
|table Date1,Date2,Date3,name,Doc
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Mar 2019 02:24:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-rows-with-a-common-field/m-p/439710#M125070</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2019-03-14T02:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge rows with a common field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-rows-with-a-common-field/m-p/439711#M125071</link>
      <description>&lt;P&gt;I prefer not to use join due performance issues. Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 14:46:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-rows-with-a-common-field/m-p/439711#M125071</guid>
      <dc:creator>ndaniel88</dc:creator>
      <dc:date>2019-03-14T14:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge rows with a common field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-rows-with-a-common-field/m-p/439712#M125072</link>
      <description>&lt;P&gt;Why strange? that's exactly how my data looks, but with real data, lol.&lt;/P&gt;

&lt;P&gt;Anyways, your answer works like a charm, Thank you, I appreciate.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 14:47:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-rows-with-a-common-field/m-p/439712#M125072</guid>
      <dc:creator>ndaniel88</dc:creator>
      <dc:date>2019-03-14T14:47:48Z</dc:date>
    </item>
  </channel>
</rss>

