<?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: comparing fields to find identical values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533188#M150652</link>
    <description>&lt;P&gt;So here's my modification on what you provided&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=import [ search 
     index=import 
     | dedup Customer_Full_Name 
     | rename Customer_Full_Name AS User_Full_Name 
     | fields User_Full_Name 
     ]
| table _time User_Full_Name Customer_Full_Name&lt;/LI-CODE&gt;&lt;P&gt;I think it's working as there are much fewer results 1,241 (The total number of events in this index is around 60,000)&amp;nbsp;and only 7 users are listed having accessed records.&lt;/P&gt;&lt;P&gt;If I reverse the field values thus:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=import [ search 
     index=import 
     | dedup User_Full_Name 
     | rename User_Full_Name AS Customer_Full_Name
     | fields Customer_Full_Name
     ]
| table _time User_Full_Name Customer_Full_Name&lt;/LI-CODE&gt;&lt;P&gt;My results are different. Shouldn't I get the same results?&lt;/P&gt;</description>
    <pubDate>Tue, 15 Dec 2020 16:05:50 GMT</pubDate>
    <dc:creator>aaronzabell</dc:creator>
    <dc:date>2020-12-15T16:05:50Z</dc:date>
    <item>
      <title>comparing fields to find identical values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533089#M150602</link>
      <description>&lt;P&gt;I imported a csv into Splunk and now I need to compare two of the fields to find identical values. Compare the values of "Customer_Full_Name" and "User_Full_Name" to find who, if anyone, is both a customer and a user.&lt;/P&gt;&lt;P&gt;I feel like eval should be able to help here but can't think of how to do it.&lt;/P&gt;&lt;P&gt;Once I have that figured out I need to see if there are users looking at the records of customers that happen to also be users but I'll leave that for another question later.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 00:45:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533089#M150602</guid>
      <dc:creator>aaronzabell</dc:creator>
      <dc:date>2020-12-15T00:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: comparing fields to find identical values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533104#M150611</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/914"&gt;@aaronzabell&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I think that you want to compare fields in the same event.&lt;/P&gt;&lt;P&gt;In this case you can use the search command&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| search "Customer_Full_Name" = "User_Full_Name"&lt;/LI-CODE&gt;&lt;P&gt;having only the events with this condition.&lt;/P&gt;&lt;P&gt;If instead you want all the events but with highlighted the corrisponding ones you can use eval&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval check=if("Customer_Full_Name"="User_Full_Name","Yes","Not")&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 07:54:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533104#M150611</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-12-15T07:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: comparing fields to find identical values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533148#M150633</link>
      <description>&lt;P&gt;The first search function works just fine but not exactly what I'm looking for.&lt;BR /&gt;The second option just ends up returning all of the events and doesn't break anything down.&lt;BR /&gt;What I want to do, is eliminate from the results all customers that aren't users.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 13:51:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533148#M150633</guid>
      <dc:creator>aaronzabell</dc:creator>
      <dc:date>2020-12-15T13:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: comparing fields to find identical values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533154#M150639</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/914"&gt;@aaronzabell&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;as I said the second search tags events that match the condition but it doesn't filter results.&lt;/P&gt;&lt;P&gt;If you want only results that match the condition you have to use the first one.&lt;/P&gt;&lt;P&gt;What do you mean when you say that it isn't&lt;SPAN&gt;&amp;nbsp;exactly what you're looking for?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ciao.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Giuseppe&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 14:11:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533154#M150639</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-12-15T14:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: comparing fields to find identical values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533163#M150642</link>
      <description>&lt;P&gt;If I only want the events where they look up their own record I can use this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=customers | where Customer_Full_Name=User_Full_Name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which is similar to the eval you posted, just without tags.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| search "Customer_Full_Name" = "User_Full_Name"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;returns no results at all.&lt;/P&gt;&lt;P&gt;The search needs to take the value of&amp;nbsp;Customer_Full_Name in a single event and compare it with the results of User_Full_Name in every event to see if it matches then return only those results. I'm hoping that I'm making at least some sense.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 14:44:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533163#M150642</guid>
      <dc:creator>aaronzabell</dc:creator>
      <dc:date>2020-12-15T14:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: comparing fields to find identical values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533166#M150644</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/914"&gt;@aaronzabell&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;let me understand do you want to:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;compare two fields in the same events,&lt;/LI&gt;&lt;LI&gt;or check if the values of the field "Customer_Full_Name" is present in the field "User_Full_Name"?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;In the first case my previous answer is correct.&lt;/P&gt;&lt;P&gt;In the second case, you have to use a subsearch:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt; [ search 
     &amp;lt;your_search&amp;gt; 
     | dedup "Customer_Full_Name" 
     | rename "Customer_Full_Name" AS "User_Full_Name" 
     | fields "User_Full_Name" 
     ]
| table _time "Customer_Full_Name"&lt;/LI-CODE&gt;&lt;P&gt;Remember that there's the limit of 50,000 results on subsearches.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 14:58:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533166#M150644</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-12-15T14:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: comparing fields to find identical values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533188#M150652</link>
      <description>&lt;P&gt;So here's my modification on what you provided&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=import [ search 
     index=import 
     | dedup Customer_Full_Name 
     | rename Customer_Full_Name AS User_Full_Name 
     | fields User_Full_Name 
     ]
| table _time User_Full_Name Customer_Full_Name&lt;/LI-CODE&gt;&lt;P&gt;I think it's working as there are much fewer results 1,241 (The total number of events in this index is around 60,000)&amp;nbsp;and only 7 users are listed having accessed records.&lt;/P&gt;&lt;P&gt;If I reverse the field values thus:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=import [ search 
     index=import 
     | dedup User_Full_Name 
     | rename User_Full_Name AS Customer_Full_Name
     | fields Customer_Full_Name
     ]
| table _time User_Full_Name Customer_Full_Name&lt;/LI-CODE&gt;&lt;P&gt;My results are different. Shouldn't I get the same results?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 16:05:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533188#M150652</guid>
      <dc:creator>aaronzabell</dc:creator>
      <dc:date>2020-12-15T16:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: comparing fields to find identical values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533204#M150655</link>
      <description>&lt;P&gt;I tried creating a new index and imported a much smaller subset of data that I knew the results for so it was easier to verify the Splunk search results.&lt;/P&gt;&lt;P&gt;This worked:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=easy_c [ search 
     index=easy_c 
     | dedup User_Full_Name 
     | rename User_Full_Name AS Customer_Full_Name
     | fields Customer_Full_Name 
     ]
| table _time User_Full_Name Customer_Full_Name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your help in getting this figured out&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 17:19:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533204#M150655</guid>
      <dc:creator>aaronzabell</dc:creator>
      <dc:date>2020-12-15T17:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: comparing fields to find identical values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533205#M150656</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/914"&gt;@aaronzabell&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you!&lt;/P&gt;&lt;P&gt;Please, accept the answer for the other poeple of Community.&lt;/P&gt;&lt;P&gt;Ciao and happy splunking.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 17:21:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533205#M150656</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-12-15T17:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: comparing fields to find identical values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/670884#M229946</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@ gcusello,&lt;BR /&gt;&lt;BR /&gt;I have similar problem with my use case. I am looking to filter out from two lookup files. I am not using any index. can you help me with to compare filed values from two difference lookup files?&lt;/P&gt;&lt;P&gt;below are the sample data from two lookup file&lt;BR /&gt;&lt;BR /&gt;1.&lt;SPAN&gt;Firewall_NEW_Database.csv o&lt;BR /&gt;Hostname Location Datacenter&lt;BR /&gt;ABCD&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;US&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xyz&lt;BR /&gt;&lt;SPAN&gt;LMNO&amp;nbsp; &amp;nbsp; &amp;nbsp;SING&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ABC&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;2,Firewall_OLD_Database.csv.&amp;nbsp;&lt;BR /&gt;Firewall Location Datacenter&amp;nbsp;&lt;BR /&gt;LMNO&amp;nbsp; &amp;nbsp; &amp;nbsp;SING&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ABC&lt;BR /&gt;&lt;SPAN&gt;ABCD&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;US&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xyz&lt;/SPAN&gt;&lt;BR /&gt;EFGH&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CAN&amp;nbsp; &amp;nbsp; &amp;nbsp; PQR&lt;BR /&gt;&lt;BR /&gt;in above two lookups I want to compare similar values&amp;nbsp; base on Hostname and Firewall fields and filter it out with count.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 16:58:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/670884#M229946</guid>
      <dc:creator>Mr_Adate</dc:creator>
      <dc:date>2023-12-05T16:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: comparing fields to find identical values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/670896#M229949</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252530"&gt;@Mr_Adate&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;it isn't a good idea to add a new post, even if on the same topic, to an existing question (especially when closed!) because it's more difficoult to have an answer, so, next time open a new question.&lt;/P&gt;&lt;P&gt;Anyway, what do you mean with "compare": do you want to filter the rows of one lookup with the ones of the second?&lt;/P&gt;&lt;P&gt;or do you want to know if a value is present in both the lookups or in one of them?&lt;/P&gt;&lt;P&gt;if the first, please try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup Firewall_NEW_Database.csv WHERE [ | inputlookup Firewall_OLD_Database.csv | rename Firewall AS Hostname | fields Hostname ]
| table Hostname Location Datacenter&lt;/LI-CODE&gt;&lt;P&gt;if the second, please try:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup Firewall_NEW_Database.csv
| eval lookup="Firewall_NEW_Database.csv" 
| append [ 
   | inputlookup Firewall_OLD_Database.csv 
   | rename Firewall AS Hostname 
   | eval lookup="Firewall_OLD_Database.csv" 
   | fields Hostname Location Datacenter lookup ]
| stats 
   values(Location) AS Location
   values(Datacenter) AS Datacenter
   dc(lookup) AS lookup_count
   values(lookup) AS lookup
   BY Hostname 
| eval lookup=if(lookup_count=2, "Both lookups",lookup)
| table Hostname Location Datacenter lookup&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 18:04:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/670896#M229949</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-12-05T18:04:20Z</dc:date>
    </item>
  </channel>
</rss>

