<?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 do you find the difference between two different indexes with fields in common? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424965#M121850</link>
    <description>&lt;P&gt;Hi Somesoni2,&lt;/P&gt;

&lt;P&gt;Thanks for the query, I want to make sure the tradeid in index 1 is available in index 2, basically no difference between first index and second index. &lt;BR /&gt;
If there is a difference, then it means the tradeid's are not available in either of the index. will  where clause indexes=2 should be used here? . just only the differences should be shown if there is no difference no results - - all good. if there is a difference only those trades needs to be shown -- need to check those trades&lt;/P&gt;

&lt;P&gt;let me know if I'm not clear&lt;/P&gt;</description>
    <pubDate>Sat, 26 Jan 2019 19:20:19 GMT</pubDate>
    <dc:creator>ashrafshareeb</dc:creator>
    <dc:date>2019-01-26T19:20:19Z</dc:date>
    <item>
      <title>How do you find the difference between two different indexes with fields in common?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424963#M121848</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I am working on a piece of work on reconciling the trades from DB and a log. I had a thought that the below query should be working fine, but it is not. It has shown be 9K differences if I ran it against Today or yesterday time range. I have checked the query separately to see if the version has changed, but it's the same version and same trade when I ran the 2 searches separately.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| set diff [search index=stdb sourcetype=stdbtype  
| dedup TRADEID sortby -AUD_VER
| rename TRADEID as tradeId,AUD_VER as SMTVersion    
| table tradeId, SMTVersion]
[search index=XXX_inbound SMT55/BOND_TR  
| dedup tradeId sortby -SMTVersion
| table tradeId, SMTVersion]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I investigate a few trades, the version and the trade ID are the same, but it shows as a difference in the above query. &lt;/P&gt;

&lt;P&gt;I'm not sure why and I'm pretty much confused.&lt;/P&gt;

&lt;P&gt;Any help is much appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 16:16:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424963#M121848</guid>
      <dc:creator>ashrafshareeb</dc:creator>
      <dc:date>2019-01-25T16:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do you find the difference between two different indexes with fields in common?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424964#M121849</link>
      <description>&lt;P&gt;I would try like this (your query uses subsearches which have limitations so try this version)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;( index=stdb sourcetype=stdbtype  ) OR (index=XXX_inbound SMT55/BOND_TR  )
| fields TRADEID AUD_VER tradeId SMTVersion index
| eval tradeId=coalesce(TRADEID, tradeId)
| eval SMTVersion=coalesce(SMTVersion,AUD_VER )
| stats dc(index) as indexes by tradeId SMTVersion
| where indexes=1 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;We basically select data from both indexes in same base search, create common fields based on field values available (since they have different names in different indexes, that eval-coalesce will create a field with common name for event from both indexes). The stats will check how many indexes the (combined) tradeId SMTVersion combinations are reporting to. The last where clause selects only the tradeId SMTVersion combinations which are only reported on one index (not both, else the indexes value will be 2).&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 17:07:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424964#M121849</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-01-25T17:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do you find the difference between two different indexes with fields in common?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424965#M121850</link>
      <description>&lt;P&gt;Hi Somesoni2,&lt;/P&gt;

&lt;P&gt;Thanks for the query, I want to make sure the tradeid in index 1 is available in index 2, basically no difference between first index and second index. &lt;BR /&gt;
If there is a difference, then it means the tradeid's are not available in either of the index. will  where clause indexes=2 should be used here? . just only the differences should be shown if there is no difference no results - - all good. if there is a difference only those trades needs to be shown -- need to check those trades&lt;/P&gt;

&lt;P&gt;let me know if I'm not clear&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 19:20:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424965#M121850</guid>
      <dc:creator>ashrafshareeb</dc:creator>
      <dc:date>2019-01-26T19:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do you find the difference between two different indexes with fields in common?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424966#M121851</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=stdb sourcetype=stdbtype) OR (index=XXX_inbound SMT55/BOND_TR)
| rename TRADEID AS tradeId, AUD_VER AS SMTVersion
| stats dc(index) AS index_count values(index) AS index_values BY tradeId SMTVersion
| where index_count &amp;lt; 2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 26 Jan 2019 22:02:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424966#M121851</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-26T22:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do you find the difference between two different indexes with fields in common?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424967#M121852</link>
      <description>&lt;P&gt;While trying the above query - I'm getting &lt;CODE&gt;Error in 'stats' command: The argument 'index_values' is invalid.&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 09:32:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424967#M121852</guid>
      <dc:creator>ashrafshareeb</dc:creator>
      <dc:date>2019-01-28T09:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do you find the difference between two different indexes with fields in common?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424968#M121853</link>
      <description>&lt;P&gt;Hi Somesoni2,&lt;/P&gt;

&lt;P&gt;The query was useful with indexes=1 where the trades in one index is not available in the other index is quite helpful. I have found that the DBConnect has not pulled few trades. Thanks a lot for the query&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 10:03:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424968#M121853</guid>
      <dc:creator>ashrafshareeb</dc:creator>
      <dc:date>2019-01-28T10:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do you find the difference between two different indexes with fields in common?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424969#M121854</link>
      <description>&lt;P&gt;Hi Somesoni2,&lt;/P&gt;

&lt;P&gt;I have few trades that are available in both the indexes but still appears in the above query.&lt;BR /&gt;
index=XXX_inbound SMT55/BOND_TR has multiple version, I just want to take the latest versions and compare against the first index. &lt;/P&gt;

&lt;P&gt;For eg: 0001414386&lt;BR /&gt;
The trade is available in index1, as version 4&lt;BR /&gt;
But the same trade is available in index2, as version 3 and version 4. I just want to take the latest version and compare it against index 1.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:59:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424969#M121854</guid>
      <dc:creator>ashrafshareeb</dc:creator>
      <dc:date>2020-09-29T22:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do you find the difference between two different indexes with fields in common?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424970#M121855</link>
      <description>&lt;P&gt;I forgot an &lt;CODE&gt;AS&lt;/CODE&gt;.  I edited my answer and fixed it.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 18:30:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-difference-between-two-different-indexes/m-p/424970#M121855</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-28T18:30:31Z</dc:date>
    </item>
  </channel>
</rss>

