<?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 find a value from index1/table1 in index2/table2? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436307#M124354</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=MySearch1 NOT [search index=MySearch2 | stats count BY RefToMessageID | table RefToMessageID | rename RefToMessageID AS MessageID]
| stats count BY MessageID
| dedup MessageID
| table MessageID
| rename MessageID AS messageid
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 02 May 2019 04:38:41 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-05-02T04:38:41Z</dc:date>
    <item>
      <title>How to find a value from index1/table1 in index2/table2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436305#M124352</link>
      <description>&lt;P&gt;I have made two indexes and set the values into a table. How can i find a value from table1 in table2 and present de value wich is not found in table2.&lt;BR /&gt;
 In table 2 are more results as in table1. I just want to see the value from table1 wich is not found in table2.&lt;/P&gt;

&lt;P&gt;This is my search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=MySearch1 | stats by MessageID | dedup MessageID | table MessageID | rename MessageID as messageid | append [search index=MySearch2" | stats by RefToMessageID | dedup RefToMessageID | table RefToMessageID | sort -_time] | rename RefToMessageID as reftomessageid | foreach messageid [eval match=if(messageid!=reftomessageid, "NOK", "OK")] | stats values(messageid) values(reftomessageid) values(match)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Only one value(match) gives "OK", the others are empty. What am i doing wrong?&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 10:52:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436305#M124352</guid>
      <dc:creator>sjansma</dc:creator>
      <dc:date>2019-05-01T10:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a value from index1/table1 in index2/table2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436306#M124353</link>
      <description>&lt;P&gt;@sjansma &lt;/P&gt;

&lt;P&gt;Can you please try this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=MySearch1 
| stats count by MessageID 
| eval flag=1 
| append 
    [ search index=MySearch2 
    | stats count by RefToMessageID 
    | rename RefToMessageID as MessageID
    | eval flag=2] 
| stats values(flag) as flag by MessageID 
| where flag=2 AND flag!=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 11:50:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436306#M124353</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-05-01T11:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a value from index1/table1 in index2/table2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436307#M124354</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=MySearch1 NOT [search index=MySearch2 | stats count BY RefToMessageID | table RefToMessageID | rename RefToMessageID AS MessageID]
| stats count BY MessageID
| dedup MessageID
| table MessageID
| rename MessageID AS messageid
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 May 2019 04:38:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436307#M124354</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-05-02T04:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a value from index1/table1 in index2/table2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436308#M124355</link>
      <description>&lt;P&gt;Hi @sjansma,&lt;/P&gt;

&lt;P&gt;What you're trying to do is very ressource intensive, better avoid using &lt;CODE&gt;append&lt;/CODE&gt; and subsearches when possible.&lt;/P&gt;

&lt;P&gt;Try this one liner :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=MySearch1 OR  index=MySearch2 | stats count values(index) as index by MessageID | search NOT index=MySearch2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What this does is grab all events from both indexes, checks the number of time each messageID appeared and in which source it was shown, then finally gives all the events that are not in MySearch2 but are in MySearch1.&lt;/P&gt;

&lt;P&gt;Let me know if this helps !&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 07:17:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436308#M124355</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-02T07:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a value from index1/table1 in index2/table2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436309#M124356</link>
      <description>&lt;P&gt;This is working. But in the answer of @DavidHourani he says thats it's better not to use 'append' because it should be very resource intensive. ??&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 10:01:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436309#M124356</guid>
      <dc:creator>sjansma</dc:creator>
      <dc:date>2019-05-08T10:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a value from index1/table1 in index2/table2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436310#M124357</link>
      <description>&lt;P&gt;This is not working. I got no result where i expect result. Maybe due to that for both searches i use the same index. Search1 gives must give al list with MessageID's , search2 give al iist with RefToMessageID's. I am looking for the MessageID's wich has not a RefToMessageID (MessageID = RefToMessageID)&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 10:01:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436310#M124357</guid>
      <dc:creator>sjansma</dc:creator>
      <dc:date>2019-05-08T10:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a value from index1/table1 in index2/table2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436311#M124358</link>
      <description>&lt;P&gt;This is working&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 10:01:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436311#M124358</guid>
      <dc:creator>sjansma</dc:creator>
      <dc:date>2019-05-08T10:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a value from index1/table1 in index2/table2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436312#M124359</link>
      <description>&lt;P&gt;oh, okay my search will only works for two different indexes. If both are in the same index then @woodcock's answer is the way to go &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 10:25:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-a-value-from-index1-table1-in-index2-table2/m-p/436312#M124359</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-08T10:25:15Z</dc:date>
    </item>
  </channel>
</rss>

