<?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 compare values from two fields from different sources but only keep an uncommon value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-values-from-two-fields-from-different-sources-but/m-p/248402#M74132</link>
    <description>&lt;P&gt;Try this.  It will show event in the subsearch that are not in the main search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| ldapsearch search=(&amp;amp;(objectClass=group)(cn=OMITTED)) attrs="member"
| mvexpand member | xmlkv| eval member= substr(member, 4,6)|rename member AS Field1| join type=inner Field1 [search sourcetype="OMITTED2" source="OMITTED3" OMITTED4=OMITTED5| rename OMITTED6 AS Field1]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 28 Nov 2016 17:59:37 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2016-11-28T17:59:37Z</dc:date>
    <item>
      <title>How to compare values from two fields from different sources but only keep an uncommon value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-values-from-two-fields-from-different-sources-but/m-p/248401#M74131</link>
      <description>&lt;P&gt;Hi community,&lt;/P&gt;

&lt;P&gt;I have a combined search which includes two sourcetypes. Both include a field with a username. Let's say it looks like this:&lt;/P&gt;

&lt;P&gt;Sourcetype1 &lt;STRONG&gt;Field1&lt;/STRONG&gt;: &lt;/P&gt;

&lt;P&gt;User1&lt;BR /&gt;
User2&lt;/P&gt;

&lt;P&gt;Sourcetype2 &lt;STRONG&gt;Field2&lt;/STRONG&gt;:&lt;/P&gt;

&lt;P&gt;User1&lt;BR /&gt;
User2&lt;BR /&gt;
&lt;EM&gt;User3&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;I need the values that are present in &lt;STRONG&gt;Field2&lt;/STRONG&gt;, and are not in &lt;STRONG&gt;Field1&lt;/STRONG&gt;. The other way around is not of interest, so a simple count and looking at &amp;lt;2 is not an option. So, my search needs to reflect that &lt;STRONG&gt;User3&lt;/STRONG&gt; is a value of an event in &lt;STRONG&gt;Field2&lt;/STRONG&gt;, but not a value of an event in &lt;STRONG&gt;Field1&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;How do I do that within my search?&lt;/P&gt;

&lt;P&gt;The search itself:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| ldapsearch search=(&amp;amp;(objectClass=group)(cn=*OMITTED*)) attrs="member"
| mvexpand member | xmlkv| eval member= substr(member, 4,6)|rename member AS Field1|  append [search sourcetype="*OMITTED2*" source="*OMITTED3*" *OMITTED4*=*OMITTED5*| rename *OMITTED6* AS Field2] 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With many thanks! &lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 16:43:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-values-from-two-fields-from-different-sources-but/m-p/248401#M74131</guid>
      <dc:creator>splunkerneedshe</dc:creator>
      <dc:date>2016-11-28T16:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare values from two fields from different sources but only keep an uncommon value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-values-from-two-fields-from-different-sources-but/m-p/248402#M74132</link>
      <description>&lt;P&gt;Try this.  It will show event in the subsearch that are not in the main search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| ldapsearch search=(&amp;amp;(objectClass=group)(cn=OMITTED)) attrs="member"
| mvexpand member | xmlkv| eval member= substr(member, 4,6)|rename member AS Field1| join type=inner Field1 [search sourcetype="OMITTED2" source="OMITTED3" OMITTED4=OMITTED5| rename OMITTED6 AS Field1]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Nov 2016 17:59:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-values-from-two-fields-from-different-sources-but/m-p/248402#M74132</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-11-28T17:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare values from two fields from different sources but only keep an uncommon value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-values-from-two-fields-from-different-sources-but/m-p/248403#M74133</link>
      <description>&lt;P&gt;It gives back 0 results. If I place:&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;join type=inner SOME_BOGUS_FIELD&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;instead of&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;join type=inner Field1&lt;/EM&gt; &lt;/P&gt;

&lt;P&gt;It gives results. But way less values for Field2 than I would expect. So something is not working correctly. Maybe that has to do with the ldapsearch module. I tried converting Field1 to string using:&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;eval Field1=tostring(Field1)&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;but that did not help. &lt;/P&gt;

&lt;P&gt;Do you have any idea how to proceed?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:59:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-values-from-two-fields-from-different-sources-but/m-p/248403#M74133</guid>
      <dc:creator>splunkerneedshe</dc:creator>
      <dc:date>2020-09-29T11:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare values from two fields from different sources but only keep an uncommon value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-values-from-two-fields-from-different-sources-but/m-p/248404#M74134</link>
      <description>&lt;P&gt;Perhaps I renamed the wrong OMITTED field to Field1.  Modify the query so Field1 is the same in both the main search and the subsearch.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 13:22:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-values-from-two-fields-from-different-sources-but/m-p/248404#M74134</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-11-29T13:22:24Z</dc:date>
    </item>
  </channel>
</rss>

