<?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: Need help to compare a CSV file with an index in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Need-help-to-compare-a-CSV-file-with-an-index/m-p/468143#M80616</link>
    <description>&lt;P&gt;thanks even if the search is very long&lt;/P&gt;</description>
    <pubDate>Wed, 30 Oct 2019 13:38:55 GMT</pubDate>
    <dc:creator>jip31</dc:creator>
    <dc:date>2019-10-30T13:38:55Z</dc:date>
    <item>
      <title>Need help to compare a CSV file with an index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Need-help-to-compare-a-CSV-file-with-an-index/m-p/468139#M80612</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I need to compare the field host of my CSV file with the field host of my index.&lt;BR /&gt;
I used the search below but I have no results.&lt;BR /&gt;
What is wrong, please!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup test.csv 
| lookup test.csv HOSTNAME as host output SITE STATUS 
| join host 
    [ search index=tutu] 
| stats values(SITE) as SITE, values(STATUS) as STATUS by host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Oct 2019 10:40:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Need-help-to-compare-a-CSV-file-with-an-index/m-p/468139#M80612</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2019-10-30T10:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to compare a CSV file with an index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Need-help-to-compare-a-CSV-file-with-an-index/m-p/468140#M80613</link>
      <description>&lt;P&gt;This is doing a join on an entire index which is unnecessary. Here is how you want to do it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=tutu 
    [| inputlookup test.csv 
    | rename HOSTNAME as host 
    | fields host] 
| lookup test.csv HOSTNAME as host output SITE STATUS 
| stats values(SITE) as SITE, values(STATUS) as STATUS by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;line 1 is fetching data from your index tutu&lt;BR /&gt;
line 2-4 is a subquery  which filters your data to only those hosts present in the file&lt;BR /&gt;
line 5 is then doing a lookup and fetching the site and status and line 6 is your stats which is summarizing these&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;BR /&gt;
Cheers&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 11:20:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Need-help-to-compare-a-CSV-file-with-an-index/m-p/468140#M80613</guid>
      <dc:creator>arjunpkishore5</dc:creator>
      <dc:date>2019-10-30T11:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to compare a CSV file with an index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Need-help-to-compare-a-CSV-file-with-an-index/m-p/468141#M80614</link>
      <description>&lt;P&gt;@jip31&lt;/P&gt;

&lt;P&gt;Can you please share your expected output?&lt;BR /&gt;
Meanwhile try by replacing lookup command with below one. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| lookup test.csv HOSTNAME as host OUTPUTNEW HOSTNAME as host,SITE, STATUS&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 11:22:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Need-help-to-compare-a-CSV-file-with-an-index/m-p/468141#M80614</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-10-30T11:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to compare a CSV file with an index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Need-help-to-compare-a-CSV-file-with-an-index/m-p/468142#M80615</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Please try below query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=tutu
| stats count by host
| fields - count
| inputlookup test2.csv append=t
| eval host=lower(host)
| stats count, values(SITE) as SITE, values(STATUS) as STATUS by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want to see only those host which are matching with lookup only then you can try below query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=tutu
| stats count by host
| fields - count
| lookup test2.csv host OUTPUT
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Oct 2019 11:26:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Need-help-to-compare-a-CSV-file-with-an-index/m-p/468142#M80615</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-10-30T11:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to compare a CSV file with an index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Need-help-to-compare-a-CSV-file-with-an-index/m-p/468143#M80616</link>
      <description>&lt;P&gt;thanks even if the search is very long&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 13:38:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Need-help-to-compare-a-CSV-file-with-an-index/m-p/468143#M80616</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2019-10-30T13:38:55Z</dc:date>
    </item>
  </channel>
</rss>

