<?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 lookup to an index in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-compare-lookup-to-an-index/m-p/620000#M106864</link>
    <description>&lt;P&gt;Use this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=DB DNS="*aws.amazon.com*"
| dedup DNS
| stats count by DNS
| eval isIx=1
| append [
  | inputlookup dataFile
  | rename hostname as DNS
  | eval isIx=0
]
| stats max(isIx) as isIx values(count) by DNS
| eval matched=if(isIx=0, "No Match", "Matched")
| stats sum(count) BY matched&lt;/LI-CODE&gt;&lt;P&gt;What you are doing is searching the index data, marking those as finds_in_index (isIx) and then appending the lookup file and marking them as not index finds.&lt;/P&gt;&lt;P&gt;Then join them together and those with isIx set to 1 were index finds, the others not.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Nov 2022 23:19:18 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2022-11-07T23:19:18Z</dc:date>
    <item>
      <title>How to compare lookup to an index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-compare-lookup-to-an-index/m-p/619994#M106863</link>
      <description>&lt;P&gt;Hey all,&lt;BR /&gt;Looking for some assistance on this splunk search. I've looked at other examples but for some reason I'm unable to replicate that with our data set.&lt;BR /&gt;&lt;BR /&gt;Currently have:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=DB DNS="*aws.amazon.com*"
| dedup DNS
| stats count by DNS
| lookup dataFile hostname AS DNS OUTPUT hostname as matched
| eval matched=if(isnull(matched), "No Match", "Matched")
| stats sum(count) BY matched&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So what this is doing is matching the Index and lookup file name DataFile by the DNS name and it just gives me the count of what matches and the count of what doesn't have a match in dataFile.&lt;BR /&gt;&lt;BR /&gt;However, I'm looking for this but essentially flipped. I need the results of the lookup table "dataFile" to be the base set of data and compare that to the index named DB so that it displays the count of assets not matched in the index.&lt;BR /&gt;&lt;BR /&gt;I've tried something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=DB DNS="*aws.amazon.com*"
 [|inputlookup dataFile
  | rename hostname as host
  | fields host]
| lookup dataFile hostname as DNS output hostname
| stats values(hostname) as host&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but no it just keeps parsing so something is wrong here. Not sure what may be the best approach here.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2022 16:02:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-compare-lookup-to-an-index/m-p/619994#M106863</guid>
      <dc:creator>Manik_</dc:creator>
      <dc:date>2022-11-08T16:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing lookup to an index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-compare-lookup-to-an-index/m-p/620000#M106864</link>
      <description>&lt;P&gt;Use this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=DB DNS="*aws.amazon.com*"
| dedup DNS
| stats count by DNS
| eval isIx=1
| append [
  | inputlookup dataFile
  | rename hostname as DNS
  | eval isIx=0
]
| stats max(isIx) as isIx values(count) by DNS
| eval matched=if(isIx=0, "No Match", "Matched")
| stats sum(count) BY matched&lt;/LI-CODE&gt;&lt;P&gt;What you are doing is searching the index data, marking those as finds_in_index (isIx) and then appending the lookup file and marking them as not index finds.&lt;/P&gt;&lt;P&gt;Then join them together and those with isIx set to 1 were index finds, the others not.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2022 23:19:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-compare-lookup-to-an-index/m-p/620000#M106864</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-11-07T23:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing lookup to an index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-compare-lookup-to-an-index/m-p/620186#M106886</link>
      <description>&lt;P&gt;Thank you, this was great!&lt;BR /&gt;&lt;BR /&gt;All I did was add a where clause for the inputlookup and it worked great to compare and filter by column&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|inputlookup dataFile where hostname="*aws.amazon.com*"
| fields hostname&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2022 21:32:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-compare-lookup-to-an-index/m-p/620186#M106886</guid>
      <dc:creator>Manik_</dc:creator>
      <dc:date>2022-11-08T21:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing lookup to an index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-compare-lookup-to-an-index/m-p/620202#M106888</link>
      <description>&lt;P&gt;If the question is solved, please accept the solution so others can benefit&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2022 23:44:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-compare-lookup-to-an-index/m-p/620202#M106888</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-11-08T23:44:25Z</dc:date>
    </item>
  </channel>
</rss>

