<?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 I find rows in a table with more fields, which are NOT EQUAL to any row in table with less fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-find-rows-in-a-table-with-more-fields-which-are-NOT/m-p/379283#M111143</link>
    <description>&lt;P&gt;Assuming these tables aren't over 50k rows (default max of a join subsearch) you could join the results together, and do some eval tricks to compare the data and filter it out.  So something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;search1&amp;gt;: ... | table id, f1, f2, f3 | join type=left id [ &amp;lt;search2&amp;gt;: ... | table id, f1, f2 | rename f1 as f1_x | rename f2 as f2_x] | eval filter_out=if(f1=f1_x AND f2=f2_x,"filter","keep") | search filter_out=keep
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 20 Dec 2018 23:35:35 GMT</pubDate>
    <dc:creator>briancronrath</dc:creator>
    <dc:date>2018-12-20T23:35:35Z</dc:date>
    <item>
      <title>How do I find rows in a table with more fields, which are NOT EQUAL to any row in table with less fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-find-rows-in-a-table-with-more-fields-which-are-NOT/m-p/379282#M111142</link>
      <description>&lt;P&gt;I.e. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search1&amp;gt;: ... | table id, f1, f2, f3
&amp;lt;search2&amp;gt;: ... | table id, f1, f2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to find all records in &lt;CODE&gt;&amp;lt;search1&amp;gt;&lt;/CODE&gt; that are not equal to any record in &lt;CODE&gt;&amp;lt;search2&amp;gt;&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;If I do something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search1&amp;gt; | search NOT [&amp;lt;search2&amp;gt;]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Splunk will not consider record, let's say &lt;CODE&gt;&amp;lt;record1&amp;gt;: id=someID, f1=1, f2=2, f3=3&lt;/CODE&gt; in &lt;CODE&gt;&amp;lt;search1&amp;gt;&lt;/CODE&gt; different from record &lt;CODE&gt;&amp;lt;record2&amp;gt;: id=someID, f1=1, f2=2&lt;/CODE&gt; from &lt;CODE&gt;&amp;lt;search2&amp;gt;&lt;/CODE&gt; , because field &lt;CODE&gt;f3&lt;/CODE&gt; will not be presented in the boolean expression generated by the subsearch.  So it will not pass &lt;CODE&gt;&amp;lt;record1&amp;gt;&lt;/CODE&gt; to final recordset, but I need it there.  &lt;/P&gt;

&lt;P&gt;So what is the best approach there?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 19:21:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-find-rows-in-a-table-with-more-fields-which-are-NOT/m-p/379282#M111142</guid>
      <dc:creator>aovsiannikov</dc:creator>
      <dc:date>2018-12-20T19:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I find rows in a table with more fields, which are NOT EQUAL to any row in table with less fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-find-rows-in-a-table-with-more-fields-which-are-NOT/m-p/379283#M111143</link>
      <description>&lt;P&gt;Assuming these tables aren't over 50k rows (default max of a join subsearch) you could join the results together, and do some eval tricks to compare the data and filter it out.  So something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;search1&amp;gt;: ... | table id, f1, f2, f3 | join type=left id [ &amp;lt;search2&amp;gt;: ... | table id, f1, f2 | rename f1 as f1_x | rename f2 as f2_x] | eval filter_out=if(f1=f1_x AND f2=f2_x,"filter","keep") | search filter_out=keep
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Dec 2018 23:35:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-find-rows-in-a-table-with-more-fields-which-are-NOT/m-p/379283#M111143</guid>
      <dc:creator>briancronrath</dc:creator>
      <dc:date>2018-12-20T23:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I find rows in a table with more fields, which are NOT EQUAL to any row in table with less fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-find-rows-in-a-table-with-more-fields-which-are-NOT/m-p/379284#M111144</link>
      <description>&lt;P&gt;Hi aovsiannikov,&lt;BR /&gt;
if results in search2 are less than 50,000 you can use a subsearch like the following&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index1 NOT [ search index=index2 | fields id f1 f2 f3]
| ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;where &lt;CODE&gt;id, f1, f2, f3&lt;/CODE&gt; are the fields to compare results from the searches.&lt;BR /&gt;
If you want to compare the full record you can use as row the field &lt;CODE&gt;_raw&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;If instead results in search2 are more than 50,000, you have to use a different approach, something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index1 OR index=index2
| stats count BY index id f1 f2 f3
| where index=index1 AND count=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if instead you want to compare the full raw you can run something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index1 OR index=index2
| stats count BY index _raw
| where index=index1 AND count=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 21 Dec 2018 07:53:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-find-rows-in-a-table-with-more-fields-which-are-NOT/m-p/379284#M111144</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2018-12-21T07:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I find rows in a table with more fields, which are NOT EQUAL to any row in table with less fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-find-rows-in-a-table-with-more-fields-which-are-NOT/m-p/379285#M111145</link>
      <description>&lt;P&gt;Assuming that id is actually an identifier of a record, it could be as simple as this, right?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search1 OR search2
| evenstats count by id
| search f3=* count=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(the &lt;CODE&gt;f3=*&lt;/CODE&gt; is to return the rows belonging to search1. if f3 is not always populated for those items, then use some other characterizing property of the items that came from search1).&lt;/P&gt;

&lt;P&gt;If you also need to take f1 and f2 into account for matching items between the two data sets:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search1 OR search2
| evenstats count by id,f1,f2
| search f3=* count=1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Dec 2018 08:15:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-find-rows-in-a-table-with-more-fields-which-are-NOT/m-p/379285#M111145</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-12-21T08:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I find rows in a table with more fields, which are NOT EQUAL to any row in table with less fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-find-rows-in-a-table-with-more-fields-which-are-NOT/m-p/379286#M111146</link>
      <description>&lt;P&gt;Guys, thanks a lot for replies, I'd like to experiment a little bit before accepting. But I'd like to avoid to relay on exact fieldset in search 1 and 2, I'd like to have some unified approach. Means, I'd like to avoid using f3 explicitly in search. Let's imagine that fieldset for search 1 is defined in some variable, I don't know exact fieldset, it's configurable, I don't want to parse it. So the spl should be independent from what is in configuration. Also I have no _raw field, both search are came from lookup.&lt;/P&gt;

&lt;P&gt;Now all I can imagine is to search index1 twice, something like this:&lt;BR /&gt;
index=index1 | search NOT [index=index2 | search [index=index1]]&lt;/P&gt;</description>
      <pubDate>Fri, 21 Dec 2018 09:23:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-find-rows-in-a-table-with-more-fields-which-are-NOT/m-p/379286#M111146</guid>
      <dc:creator>aovsiannikov</dc:creator>
      <dc:date>2018-12-21T09:23:03Z</dc:date>
    </item>
  </channel>
</rss>

