<?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: Compare CSV file and indexed data in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477480#M81974</link>
    <description>&lt;P&gt;see &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ConfigureCSVlookups"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ConfigureCSVlookups&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Pie Chart display numeric value. &lt;BR /&gt;
&lt;CODE&gt;compare&lt;/CODE&gt; &lt;BR /&gt;
What do you mean this?&lt;/P&gt;</description>
    <pubDate>Fri, 17 Apr 2020 20:19:41 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-04-17T20:19:41Z</dc:date>
    <item>
      <title>Compare CSV file and indexed data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477479#M81973</link>
      <description>&lt;P&gt;How can I compare CSV file test.csv with one column, lets name the column"DNS" to index=myindex with field name "host"? Preferably I'd like to output the results in a pie chart where the indexed data is the total and I can do a dif against the test.csv DNS column. &lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 17:31:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477479#M81973</guid>
      <dc:creator>vulnfree</dc:creator>
      <dc:date>2020-04-17T17:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: Compare CSV file and indexed data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477480#M81974</link>
      <description>&lt;P&gt;see &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ConfigureCSVlookups"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ConfigureCSVlookups&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Pie Chart display numeric value. &lt;BR /&gt;
&lt;CODE&gt;compare&lt;/CODE&gt; &lt;BR /&gt;
What do you mean this?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 20:19:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477480#M81974</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-17T20:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: Compare CSV file and indexed data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477481#M81975</link>
      <description>&lt;P&gt;Thanks that was helpful, but I still don't know how to get the dif displayed. Meaning, I want items in my test.csv displayed that no events are matching.&lt;/P&gt;

&lt;P&gt;Step 2 would be to compare the amount of hosts in test.csv that are not matched with events, to the total number of host names reporting for a certain index and sourcetype.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 14:25:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477481#M81975</guid>
      <dc:creator>vulnfree</dc:creator>
      <dc:date>2020-04-20T14:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Compare CSV file and indexed data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477482#M81976</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex | append [ |inpulookup  test.csv | rename DNS as host] | stats count by host | stats count(eval(if(count=1, 1, null))) as no_event_hosts, count(eval(if(count&amp;gt;1, 1, null))) as hosts_with_events
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Apr 2020 14:40:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477482#M81976</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-04-20T14:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Compare CSV file and indexed data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477483#M81977</link>
      <description>&lt;P&gt;Thanks for helping out, but this didnt produce the outcome I'm looking for.&lt;/P&gt;

&lt;P&gt;Is it possible to output the test.csv DNS column and host column from the indexed data and then do a dif?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 17:06:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477483#M81977</guid>
      <dc:creator>vulnfree</dc:creator>
      <dc:date>2020-04-20T17:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: Compare CSV file and indexed data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477484#M81978</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=myindex| stats count by host | rename host as DNS |eval result="index"|append [| inputlookup test.csv |eval result="csv" ]|stats count(DNS) as tmp dc(DNS) as unique|eval duplicated = tmp - unique | eval diff = unique - duplicated | table duplicated diff  |transpose column_name=result| rename "row 1" as count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Viz&amp;gt;&amp;gt;Pie Chart&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 20:44:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477484#M81978</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-20T20:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Compare CSV file and indexed data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477485#M81979</link>
      <description>&lt;P&gt;It doesnt give me the diff. It displays the number of entries in my CSV not the difference between whats in the CSV and my indexed data.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 21:12:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477485#M81979</guid>
      <dc:creator>vulnfree</dc:creator>
      <dc:date>2020-04-20T21:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: Compare CSV file and indexed data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477486#M81980</link>
      <description>&lt;P&gt;please provide this result.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;result count
index 0
csv 20
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 21:17:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477486#M81980</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-20T21:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: Compare CSV file and indexed data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477487#M81981</link>
      <description>&lt;P&gt;Then you can simply do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=myindex | stats count by index | appendcols [ |inpulookup  test.csv | stats count as csv_count ] | eval diff = count - csv_count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Apr 2020 21:17:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/477487#M81981</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-04-20T21:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: Compare CSV file and indexed data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/570534#M101101</link>
      <description>&lt;P&gt;I do this by using stats values to combine two searches, then look for differences. The basic method follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;basic search&amp;gt;
| table &amp;lt;fields I care about&amp;gt;
| rename &amp;lt;myfield_orig&amp;gt; as &amp;lt;myfield&amp;gt; 
| eval src="&amp;lt;an identifier for this search&amp;gt;"
| append 
    [ &amp;lt;second search&amp;gt; 
      | table &amp;lt;fields I care about&amp;gt;
      | rename &amp;lt;myfield_other&amp;gt; as &amp;lt;myfield&amp;gt; 
      | eval src="&amp;lt;an identifier for this search&amp;gt;"
    ]
| fillnull value="-" &amp;lt;myfield&amp;gt;
| stats values(*) as *, dc(SRC) as match_cnt by &amp;lt;myfield&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The key is to make sure that the fields you want to compare have the same and not contain null values.&amp;nbsp; After, you can check the SRC field for unique values, and it will tell you which search is was from. You can also filter for what is in common (match_cnt==2) or different.&lt;/P&gt;&lt;P&gt;For your search something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup test.csv
| table DNS *
| rename DNS as myField
| eval src="TEST"
| append
    [ search index="myindex"
      | table host * 
      | rename host as myField
      | src="MYINDEX" ] 

| fillnull value="-" DNS host 
| stats values(*) as *, dc(SRC) as match_cnt by myField&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 00:05:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Compare-CSV-file-and-indexed-data/m-p/570534#M101101</guid>
      <dc:creator>templets</dc:creator>
      <dc:date>2021-10-12T00:05:38Z</dc:date>
    </item>
  </channel>
</rss>

