<?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 combine data from two CSV files using a common field where this field has a different name in each file? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222021#M65278</link>
    <description>&lt;P&gt;Do you get results when you run the queries separately? Try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=top10 source="/home/oracle/workdir/account_log.csv"  | table TICKET_CODE,CHANNEL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Do you get results you would expect? Then try &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/home/oracle/workdir/overalllocationdata.csv" | rename PREMISE_ID as PREMISE|table PREMISE LAST_NAME]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Do you get results you would expect?&lt;/P&gt;

&lt;P&gt;Are the field names correct (case sensitive)? Try adding a &lt;CODE&gt;PREMISE=*&lt;/CODE&gt; before the &lt;CODE&gt;| join&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Apr 2016 05:04:51 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-04-26T05:04:51Z</dc:date>
    <item>
      <title>How to combine data from two CSV files using a common field where this field has a different name in each file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222016#M65273</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have 2 CSV files that have a unique key of sorts....  The of sorts is, in one CSV file the unique key is named PREMISE, but in the other file it is named PREMISE_ID. What would be the best way to "join" the two files together using Splunk?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 22:02:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222016#M65273</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2016-04-25T22:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from two CSV files using a common field where this field has a different name in each file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222017#M65274</link>
      <description>&lt;P&gt;Not sure what you mean by join. You could try something like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=file1.csv OR source=file2.csv | eval PREMISE=coalsce(PREMISE, PREMISE_ID) | stats count by PREMISE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will give you a count of event grouped by PREMISE across both files.&lt;/P&gt;

&lt;P&gt;Now, if you want to do a JOIN like a DB JOIN, then you could do something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=file1.csv | JOIN PREMISE [ search source=file2.csv | rename PREMISE_ID as PREMISE | table PREMISE_ID ] 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Apr 2016 01:23:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222017#M65274</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-04-26T01:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from two CSV files using a common field where this field has a different name in each file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222018#M65275</link>
      <description>&lt;P&gt;Hi Sundareshr,&lt;/P&gt;

&lt;P&gt;I think you are on to something.  Let me clarify a bit&lt;/P&gt;

&lt;P&gt;file1.csv has fields:&lt;/P&gt;

&lt;P&gt;PREMISE&lt;BR /&gt;
TICKET_NUMBER&lt;BR /&gt;
REASON_CODE&lt;BR /&gt;
blah&lt;/P&gt;

&lt;P&gt;file2.csv has fields&lt;BR /&gt;
PREMISE_ID&lt;BR /&gt;
LAST_NAME&lt;BR /&gt;
FIRST_NAME&lt;BR /&gt;
blah&lt;/P&gt;

&lt;P&gt;I'm trying to join/link/reference/whatever you want to call it, the two files based off of PREMISE/PREMISE_ID.  The two fields have slightly different names but the data is the same.  Meaning PREMISE=1 in file1.csv equals PREMISE_ID=1 in file2.csv&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:32:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222018#M65275</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2020-09-29T09:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from two CSV files using a common field where this field has a different name in each file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222019#M65276</link>
      <description>&lt;P&gt;Do any of the fields repeat in both files? Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=1.csv OR source=2.csv | eval premise=coalesce(premise, premise_id) | stats list(lastname) as lname list(firstname) as fname list(ticketnumber) tnbr etc by premise
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If this doesn't give you what you're looking for, you could do the &lt;CODE&gt;join&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=file1.csv | JOIN PREMISE [ search source=file2.csv | rename PREMISE_ID as PREMISE | table PREMISE_ID LAST_NAME blah ] | table TICKET_NUMBER REASON_CODE blah
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Apr 2016 01:45:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222019#M65276</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-04-26T01:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from two CSV files using a common field where this field has a different name in each file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222020#M65277</link>
      <description>&lt;P&gt;Hmmmm, I was certain that it would work but oddly the query isn't returning any results&lt;/P&gt;

&lt;P&gt;Here is what I have&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=top10 source="/home/oracle/workdir/account_log.csv" |join PREMISE [search source="/home/oracle/workdir/overalllocationdata.csv" | rename PREMISE_ID as PREMISE|table PREMISE LAST_NAME]|table TICKET_CODE,CHANNEL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where did I go wrong?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 02:02:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222020#M65277</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2016-04-26T02:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from two CSV files using a common field where this field has a different name in each file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222021#M65278</link>
      <description>&lt;P&gt;Do you get results when you run the queries separately? Try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=top10 source="/home/oracle/workdir/account_log.csv"  | table TICKET_CODE,CHANNEL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Do you get results you would expect? Then try &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/home/oracle/workdir/overalllocationdata.csv" | rename PREMISE_ID as PREMISE|table PREMISE LAST_NAME]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Do you get results you would expect?&lt;/P&gt;

&lt;P&gt;Are the field names correct (case sensitive)? Try adding a &lt;CODE&gt;PREMISE=*&lt;/CODE&gt; before the &lt;CODE&gt;| join&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 05:04:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222021#M65278</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-04-26T05:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from two CSV files using a common field where this field has a different name in each file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222022#M65279</link>
      <description>&lt;P&gt;Ok, scratching head a bit,&lt;/P&gt;

&lt;P&gt;If I do this it works&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=top10 source="/home/oracle/workdir/account_log.csv" | table TICKET_CODE,CHANNEL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and if I do this it works&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=top10 source="/home/oracle/workdir/overalllocationdata.csv" | rename PREMISE_ID as PREMISE|table PREMISE LAST_NAME
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;aside for the starting index=top10 the commands seem to work independently (nice trick by the way)&lt;/P&gt;

&lt;P&gt;but combining them with the join and I get 0 results even though I've hacked at it trying several different combinations.  So it is something I'm doing wrong with the join.&lt;/P&gt;

&lt;P&gt;No joy with this one either   &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=top10 source="/home/oracle/workdir/account_log.csv" PREMISE="*" |join PREMISE [search source="/home/oracle/workdir/overalllocationdata.csv" | rename PREMISE_ID as PREMISE|table PREMISE LAST_NAME]|table TICKET_CODE,CHANNEL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I double checked and all the field names are in UPPER case.&lt;/P&gt;

&lt;P&gt;I'm at the point where my head hurts and I'm wondering why there is a bloody spot on the wall......&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 18:56:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222022#M65279</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2016-04-26T18:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from two CSV files using a common field where this field has a different name in each file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222023#M65280</link>
      <description>&lt;P&gt;also just FYI here is the complete tables and fields schema&lt;/P&gt;

&lt;P&gt;Account_Log.csv &lt;BR /&gt;
    CHANNEL&lt;BR /&gt;
    CID&lt;BR /&gt;
    CPE_CONVERTED&lt;BR /&gt;
    CREATION_DATE&lt;BR /&gt;
    DIFF&lt;BR /&gt;
    OBJECT_CPE_ID&lt;BR /&gt;
    OBJECT_TYPE&lt;BR /&gt;
    OPERATION_TYPE&lt;BR /&gt;
    PREMISE&lt;BR /&gt;
    PREMISE_RANK&lt;BR /&gt;
    TICKET_CODE&lt;/P&gt;

&lt;P&gt;OverallLocationData.csv &lt;BR /&gt;
    PREMISE_ID&lt;BR /&gt;
    ADDRESS1&lt;BR /&gt;
    ADDRESS2&lt;BR /&gt;
    CITY&lt;BR /&gt;
    COUNTRY&lt;BR /&gt;
    FIRST_NAME&lt;BR /&gt;
    LAST_NAME&lt;BR /&gt;
    LATITUDE&lt;BR /&gt;
    LAT_LNG_TYPE&lt;BR /&gt;
    LONGITUDE&lt;BR /&gt;
    POSTAL_CODE&lt;BR /&gt;
    PROVINCE&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:33:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-data-from-two-CSV-files-using-a-common-field/m-p/222023#M65280</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2020-09-29T09:33:03Z</dc:date>
    </item>
  </channel>
</rss>

