<?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 use join to compare results from a csv file? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616713#M214337</link>
    <description>&lt;P&gt;Thank you for this, do you know how would you structure the query to if any of the Applicant_Email(employe email) is in any of the rows of the primaryWorkEmail(employee email in directory) and basically have a new column saying "in_list" for the ones that have a match and "not in list" for the ones that doesn't have a match?&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp; you are helping me a lot is just that one piece I need to get straight&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Oct 2022 16:45:46 GMT</pubDate>
    <dc:creator>queryboy</dc:creator>
    <dc:date>2022-10-11T16:45:46Z</dc:date>
    <item>
      <title>How to use join to compare results from a csv file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616567#M214292</link>
      <description>&lt;P&gt;this query shows all employees in the company:&lt;/P&gt;
&lt;P&gt;index=EmployeeData AND sourcetype=Directory* earliest=@d&lt;BR /&gt;| search NOT Hire_Date IN ("2021-11-11","2021-05-22","2022-08-02", "2021-11-11")&lt;BR /&gt;| search Worker !="Level05" Termination_Date="" Training_Performed=""&lt;BR /&gt;| table First, Last, primaryWorkEmail, Training_Performed&lt;/P&gt;
&lt;P&gt;I need to compare with a CSV that shows all of the people who did their training, this CSV contains the field Submitted&lt;/P&gt;
&lt;P&gt;How would you structure the join to compare if xyz employee is in the CSV of people who completed their training?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 20:15:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616567#M214292</guid>
      <dc:creator>queryboy</dc:creator>
      <dc:date>2022-10-10T20:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use join to compare results from a csv file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616568#M214293</link>
      <description>&lt;P&gt;Does the CSV contain only the Submitted field?&amp;nbsp; If so, what are the values of that field (names, email addresses, etc.)?&amp;nbsp; If the CSV contains other fields, what are they?&amp;nbsp; Something is needed to correlate the CSV to the indexed data.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 20:27:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616568#M214293</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-10-10T20:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use join to compare results from a csv file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616569#M214294</link>
      <description>&lt;P&gt;Set up your CSV as a lookup. (You can do this via Splunk Web.) &amp;nbsp;The search command for matching is &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup" target="_blank" rel="noopener"&gt;lookup&lt;/A&gt;. &amp;nbsp;If your CSV contains a column called primaryWorkEmail, it is as simple as&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| lookup mylookup pimaryWorkEmail&lt;/LI-CODE&gt;&lt;P&gt;If, on the other hand, the corresponding column in lookup is eMail, for example, do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| lookup mylookup pimaryWorkEmail as eMail&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 20:28:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616569#M214294</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-10-10T20:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use join to compare results from a csv file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616580#M214300</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I uploaded the CSV to splunk this is the query:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| inputlookup trainingoct10.csv&lt;BR /&gt;| dedup Applicant_Email&lt;BR /&gt;| table Applicant_First_Name, Applicant_Last_Name, Applicant_Email, County_Searched, Training_Status&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;how can I structure my query so it will check for each of the names inside this CSV against my main query? and be able to add a field saying "in list" or "not in list"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;sorry I am new to splunk and this is getting difficult for me.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 22:48:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616580#M214300</guid>
      <dc:creator>queryboy</dc:creator>
      <dc:date>2022-10-10T22:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use join to compare results from a csv file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616582#M214302</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;&lt;SPAN&gt;how can I structure my query so it will check for each of the names inside this CSV against my main query? and be able to add a field saying "in list" or "not in list"&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Can you explain what "not in list"? &amp;nbsp;Specifically, if a user is in main search, but not found in CSV. &amp;nbsp;Is this the definition of "not in list"?&lt;/P&gt;&lt;P&gt;If so, you shouldn't need inputlookup. &amp;nbsp;The command is lookup.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=EmployeeData AND sourcetype=Directory* earliest=@d
| search NOT Hire_Date IN ("2021-11-11","2021-05-22","2022-08-02", "2021-11-11")
| search Worker !="Level05" Termination_Date="" Training_Performed=""
| table First, Last, primaryWorkEmail, Training_Performed
| lookup trainingoct10.csv Applicant_Email AS primaryWorkEmail
| eval in_list = if(isnull(Training_Status), "no", "yes")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 22:58:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616582#M214302</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-10-10T22:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to use join to compare results from a csv file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616713#M214337</link>
      <description>&lt;P&gt;Thank you for this, do you know how would you structure the query to if any of the Applicant_Email(employe email) is in any of the rows of the primaryWorkEmail(employee email in directory) and basically have a new column saying "in_list" for the ones that have a match and "not in list" for the ones that doesn't have a match?&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp; you are helping me a lot is just that one piece I need to get straight&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 16:45:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616713#M214337</guid>
      <dc:creator>queryboy</dc:creator>
      <dc:date>2022-10-11T16:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to use join to compare results from a csv file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616779#M214367</link>
      <description>&lt;P&gt;I am not sure what is being asked. &amp;nbsp;My previous code already added a column named "in_list". &amp;nbsp;It takes values of either "yes" or "no". &amp;nbsp;If you want to change the display string, just change those values.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=EmployeeData AND sourcetype=Directory* earliest=@d
| search NOT Hire_Date IN ("2021-11-11","2021-05-22","2022-08-02", "2021-11-11")
| search Worker !="Level05" Termination_Date="" Training_Performed=""
| table First, Last, primaryWorkEmail, Training_Performed
| lookup trainingoct10.csv Applicant_Email AS primaryWorkEmail
| eval in_list = if(isnull(Training_Status), "not in list", "in list")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 07:22:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616779#M214367</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-10-12T07:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to use join to compare results from a csv file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616813#M214378</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp; it gives me all results as not in list, I did this with excel and there are some names that are in list&amp;nbsp;&lt;/P&gt;&lt;P&gt;| eval in_list = if(isnull(Training_Status), "not in list", "in list")&lt;/P&gt;&lt;P&gt;is there a way to do a eval and check not for training status but only if emails in the lookup(csv) are in the main search?&lt;/P&gt;&lt;P&gt;like : | eval in_list = if(Applicant_Email in primaryWorkEmail), "in list", "not in list")&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 12:19:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616813#M214378</guid>
      <dc:creator>queryboy</dc:creator>
      <dc:date>2022-10-12T12:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to use join to compare results from a csv file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616862#M214393</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/250211"&gt;@queryboy&lt;/a&gt;&amp;nbsp;The way lookup works is that if the lookup field(s) - in my sample code,&amp;nbsp;Applicant_Email AS primaryWorkEmail, match, the command will output &lt;EM&gt;other&lt;/EM&gt; fields of the matching record. &amp;nbsp;Therefore, presence of &lt;EM&gt;other&lt;/EM&gt; field(s) is used to detect a match. &amp;nbsp;Consequentially, the absence of &lt;EM&gt;other&lt;/EM&gt; field(s) indicates absence of a match.&lt;/P&gt;&lt;P&gt;My sample code assumed that every trainee in that CSV file has a Training_Status (that is not zero length). &amp;nbsp;If this assumption is not true, pick another field that is always populated. &amp;nbsp;For example, if&amp;nbsp;&lt;SPAN&gt;Applicant_Last_Name is always populated,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=EmployeeData AND sourcetype=Directory* earliest=@d
| search NOT Hire_Date IN ("2021-11-11","2021-05-22","2022-08-02", "2021-11-11")
| search Worker !="Level05" Termination_Date="" Training_Performed=""
| table First, Last, primaryWorkEmail, Training_Performed
| lookup trainingoct10.csv Applicant_Email AS primaryWorkEmail
| eval in_list = if(isnull(Applicant_Last_Name), "not in list", "in list")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In short, your CSV &lt;EM&gt;must&lt;/EM&gt; contain at least one more column (other than&amp;nbsp;&lt;SPAN&gt;Applicant_Email) that is fully populated. &amp;nbsp;If you are uncertain of such a condition in real data, you should add a dummy column to CSV that has a non-zero-length value in every row. (That's what I had done in one extreme condition.) Then, use&amp;nbsp;&lt;FONT face="andale mono,times"&gt;| eval in_list = if(isnull(dummy), "not in list", "in list")&lt;/FONT&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 19:13:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616862#M214393</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-10-12T19:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use join to compare results from a csv file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616879#M214394</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;you are awesome! I tested with Applicant_Email for the Eval as you mentioned and is working just fine! Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 20:26:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-to-compare-results-from-a-csv-file/m-p/616879#M214394</guid>
      <dc:creator>queryboy</dc:creator>
      <dc:date>2022-10-12T20:26:33Z</dc:date>
    </item>
  </channel>
</rss>

