<?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: merge two search results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66455#M16528</link>
    <description>&lt;P&gt;The actual search string is shown below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(sourcetype="mms_export" c_status=200) OR (sourcetype="we_accesslog" " NOT *.isml) 
|stats sum(sc_bytes) as sum_m sum(Bytes_Xferred) as sum_http by client_ip
|join type=outer client_ip [search (sourcetype="we_accesslog"  *.isml) | stats sum(Bytes_Xferred) as sum_smooth by client_ip ] 
|join type=outer client_ip [search (sourcetype="fms_access" ) | chart sum(sc_bytes) as sum by client_ip, x_event | eval diff_flash=disconnect-connect ]
| fillnull sum_m sum_http sum_smooth diff_flash
| eval WMT(GB)= round(sum_m/(1024*1024*1024),4) 
| eval WEB_HTTP(GB)= round(sum_http/(1024*1024*1024),4) 
| eval WEB_SMOOTH(GB) = round(sum_smooth/(1024*1024*1024),4) 
| eval flash(GB)=round(diff_flash/(1024*1024*1024),4)
| fields client_ip WMT(GB) WEB_HTTP(GB) WEB_SMOOTH(GB) flash(GB) | addtotals
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 13 Feb 2012 01:30:53 GMT</pubDate>
    <dc:creator>KarunK</dc:creator>
    <dc:date>2012-02-13T01:30:53Z</dc:date>
    <item>
      <title>merge two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66449#M16522</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have three search results giving me three different set of results, in which three is one common filed called object and the number of results in each results may vary. I have used append to merge these results but i am not happy with the results. I need merge all these result into a single table.&lt;/P&gt;

&lt;P&gt;The structure of the search I have used is given below. (its only a sample)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;serach 1 | stats .... by object
append [ search2 | stats ..... by object
append [ search3 | stats ...... by object
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Results after append&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;OBJECT  COUNT   Requests    Uniuqe
------------------------------------
http    100
rtsp    250

http            25
rtsp            21
rtmp            10

http                        10
rtsp                        11
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What i need is as below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;OBJECT  COUNT   Requests    Uniuqe
------------------------------------
http    100     25          10
rtsp    250     21          11
rtmp            10  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I do this. Can i use join instead of append ?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2012 04:26:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66449#M16522</guid>
      <dc:creator>KarunK</dc:creator>
      <dc:date>2012-02-07T04:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: merge two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66450#M16523</link>
      <description>&lt;P&gt;It's a bit hard to tell, since you don't give an example of the actual logs. Join can be a very expensive operation, and should probably be avoided if possible. &lt;/P&gt;

&lt;P&gt;Are there three different sourcetypes involved?&lt;/P&gt;

&lt;P&gt;/k&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2012 06:59:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66450#M16523</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2012-02-07T06:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: merge two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66451#M16524</link>
      <description>&lt;P&gt;Yes there are different sourcetype involved.&lt;/P&gt;

&lt;P&gt;I have figured out a way to do it with join. But not sure whether this is the best way.&lt;/P&gt;

&lt;P&gt;Any Comments ?&lt;/P&gt;

&lt;P&gt;search 1 | stats .... by object&lt;BR /&gt;
| join type=outer object [ search2 | stats ..... by object&lt;BR /&gt;
| join type=outer object [ search3 | stats ...... by object&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2012 22:33:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66451#M16524</guid>
      <dc:creator>KarunK</dc:creator>
      <dc:date>2012-02-07T22:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: merge two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66452#M16525</link>
      <description>&lt;P&gt;The above soln  seems to be not working. It only looks for the field - object in the first search and try to join the respective results from search 2 and search 3.&lt;/P&gt;

&lt;P&gt;What I was looking for was to complete merger of the three results that means I would like to see the results from search 2 and search 3 in the final results even though corresponding object is missing in search 1.&lt;/P&gt;

&lt;P&gt;Any ideas .....&lt;/P&gt;

&lt;P&gt;Please help ???&lt;/P&gt;

&lt;P&gt;Thanks in Advance&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2012 04:13:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66452#M16525</guid>
      <dc:creator>KarunK</dc:creator>
      <dc:date>2012-02-10T04:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: merge two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66453#M16526</link>
      <description>&lt;P&gt;Couldn't you just move the stats command to the end of your query?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search 1 | append [ search2 ] | append [search 3] | stats ..... by object
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Feb 2012 09:28:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66453#M16526</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-02-10T09:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: merge two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66454#M16527</link>
      <description>&lt;P&gt;Nope its not working I am getting less no: of results than when I search separately and add them together.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2012 01:26:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66454#M16527</guid>
      <dc:creator>KarunK</dc:creator>
      <dc:date>2012-02-13T01:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: merge two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66455#M16528</link>
      <description>&lt;P&gt;The actual search string is shown below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(sourcetype="mms_export" c_status=200) OR (sourcetype="we_accesslog" " NOT *.isml) 
|stats sum(sc_bytes) as sum_m sum(Bytes_Xferred) as sum_http by client_ip
|join type=outer client_ip [search (sourcetype="we_accesslog"  *.isml) | stats sum(Bytes_Xferred) as sum_smooth by client_ip ] 
|join type=outer client_ip [search (sourcetype="fms_access" ) | chart sum(sc_bytes) as sum by client_ip, x_event | eval diff_flash=disconnect-connect ]
| fillnull sum_m sum_http sum_smooth diff_flash
| eval WMT(GB)= round(sum_m/(1024*1024*1024),4) 
| eval WEB_HTTP(GB)= round(sum_http/(1024*1024*1024),4) 
| eval WEB_SMOOTH(GB) = round(sum_smooth/(1024*1024*1024),4) 
| eval flash(GB)=round(diff_flash/(1024*1024*1024),4)
| fields client_ip WMT(GB) WEB_HTTP(GB) WEB_SMOOTH(GB) flash(GB) | addtotals
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Feb 2012 01:30:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66455#M16528</guid>
      <dc:creator>KarunK</dc:creator>
      <dc:date>2012-02-13T01:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: merge two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66456#M16529</link>
      <description>&lt;P&gt;Use 'appendcols'&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2012 12:04:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66456#M16529</guid>
      <dc:creator>ramab</dc:creator>
      <dc:date>2012-03-08T12:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: merge two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66457#M16530</link>
      <description>&lt;P&gt;Hi KarunK,&lt;/P&gt;

&lt;P&gt;Did you get the answer for your question, I am also looking for solution for the same problem. If you know the answer can you please help me.&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 19:39:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66457#M16530</guid>
      <dc:creator>Laya123</dc:creator>
      <dc:date>2016-07-19T19:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: merge two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66458#M16531</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;P&gt;search 1 | append [ search2 ] | append [search 3] &lt;BR /&gt;
| Stats values(*) AS * by OBJECT&lt;BR /&gt;
| table OBJECT     COUNT    Requests    Uniuqe&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2017 18:23:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66458#M16531</guid>
      <dc:creator>srujan9292</dc:creator>
      <dc:date>2017-07-05T18:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: merge two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66459#M16532</link>
      <description>&lt;P&gt;What about adding...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats first(*) as * by OBJECT
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...at the end of your search pipe?&lt;/P&gt;

&lt;P&gt;Limitation: This lightweight approach only works if every other column contains &lt;EM&gt;max. one unique value&lt;/EM&gt; per OBJECT. Otherwise stick with the &lt;EM&gt;values()&lt;/EM&gt; variant suggested by @srujan9292.&lt;/P&gt;</description>
      <pubDate>Tue, 08 May 2018 20:31:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/66459#M16532</guid>
      <dc:creator>romanwaldecker</dc:creator>
      <dc:date>2018-05-08T20:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: merge two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/567474#M197762</link>
      <description>&lt;P&gt;Thanks this worked for me&lt;/P&gt;</description>
      <pubDate>Fri, 17 Sep 2021 17:35:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/merge-two-search-results/m-p/567474#M197762</guid>
      <dc:creator>mehulraisinghan</dc:creator>
      <dc:date>2021-09-17T17:35:57Z</dc:date>
    </item>
  </channel>
</rss>

