<?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 Compare two indexes and report on mismatch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700121#M237606</link>
    <description>&lt;P&gt;I'm comparing two indexes, A and B, using the hostname as the common field. My current search successfully identifies whether each hostname in index A is present in index B. However, I also want to include additional information from index A, such as the operating system and device type, in the output. This information is not present in index B. How can I modify my query to display the operating system alongside the status (missing/ok) for each hostname?&lt;/P&gt;
&lt;P&gt;below is the query I am using&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=A sourcetype="Any" | eval Hostname=lower(Hostname) | table Hostname | dedup Hostname | append [ search index=B sourcetype="foo" | eval Hostname=lower(Reporting_Host) | table Hostname | dedup Hostname ] | stats count by Hostname
| eval match=if(count=1, "missing", "ok")&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 25 Sep 2024 23:00:27 GMT</pubDate>
    <dc:creator>Richy_s</dc:creator>
    <dc:date>2024-09-25T23:00:27Z</dc:date>
    <item>
      <title>Compare two indexes and report on mismatch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700121#M237606</link>
      <description>&lt;P&gt;I'm comparing two indexes, A and B, using the hostname as the common field. My current search successfully identifies whether each hostname in index A is present in index B. However, I also want to include additional information from index A, such as the operating system and device type, in the output. This information is not present in index B. How can I modify my query to display the operating system alongside the status (missing/ok) for each hostname?&lt;/P&gt;
&lt;P&gt;below is the query I am using&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=A sourcetype="Any" | eval Hostname=lower(Hostname) | table Hostname | dedup Hostname | append [ search index=B sourcetype="foo" | eval Hostname=lower(Reporting_Host) | table Hostname | dedup Hostname ] | stats count by Hostname
| eval match=if(count=1, "missing", "ok")&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 25 Sep 2024 23:00:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700121#M237606</guid>
      <dc:creator>Richy_s</dc:creator>
      <dc:date>2024-09-25T23:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two indexes and report on mismatch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700128#M237609</link>
      <description>&lt;PRE&gt;index=A sourcetype="Any" &lt;BR /&gt;| eval Hostname=lower(Hostname) &lt;BR /&gt;| table Hostname os device_type ```# Include os and device_type fields```&lt;BR /&gt;| dedup Hostname &lt;BR /&gt;| append [ &lt;BR /&gt;search index=B sourcetype="foo" &lt;BR /&gt;| eval Hostname=lower(Reporting_Host) &lt;BR /&gt;| table Hostname &lt;BR /&gt;| dedup Hostname &lt;BR /&gt;] &lt;BR /&gt;| stats values(os) as os values(device_type) as device_type count by Hostname &lt;BR /&gt;| eval match=if(count=1, "missing", "ok") &lt;BR /&gt;| table Hostname os device_type match&lt;/PRE&gt;&lt;P&gt;------&lt;/P&gt;&lt;H5&gt;&lt;STRONG&gt;If you find this solution helpful, please consider accepting it and awarding karma points !!&lt;/STRONG&gt;&lt;/H5&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2024 19:04:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700128#M237609</guid>
      <dc:creator>Jawahir</dc:creator>
      <dc:date>2024-09-25T19:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two indexes and report on mismatch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700156#M237623</link>
      <description>&lt;P&gt;First, unless you have prior knowledge that number of Hostname in index A is always larger than that in index B in any search period, "missing" simply means that the name appears only in one index. &amp;nbsp;The following does not try to address this problem, but will give you what you want, and is much simpler, perhaps more performant.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=A sourcetype="Any") OR (index=B sourcetype="foo")
| eval Hostname=coalesce(lower(Hostname), lower(Reporting_Host))
| fields index Hostname operating_system device_type
| stats values(*) as * by Hostname
| eval match=if(mvcount(index) == 1, "missing", "ok")&lt;/LI-CODE&gt;&lt;P&gt;Not only operating system and device type, you can add any other fields of interest that may only exist in one of indices.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 03:40:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700156#M237623</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-09-26T03:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two indexes and report on mismatch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700185#M237636</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/135068"&gt;@Jawahir&lt;/a&gt;&amp;nbsp; Both of your solutions are working absolutely fine.&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp; yes, index A always has larger number of hosts compared to index B.&lt;/P&gt;&lt;P&gt;I would like to further expand this query to match the IP address aswell.&amp;nbsp; Can you provide some guidance around that.&lt;/P&gt;&lt;P&gt;index A data&amp;nbsp;&lt;/P&gt;&lt;TABLE width="286"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="103.031px"&gt;Hostname&lt;/TD&gt;&lt;TD width="105.031px"&gt;IP address&lt;/TD&gt;&lt;TD width="77.2708px"&gt;OS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="103.031px"&gt;xyz&lt;/TD&gt;&lt;TD width="105.031px"&gt;&lt;P&gt;190.1.1.1,&amp;nbsp; 101.2.2.2, 102.3.3.3, 4.3.2.1&lt;/P&gt;&lt;/TD&gt;&lt;TD width="77.2708px"&gt;&lt;P&gt;Windows&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="103.031px"&gt;zbc&lt;/TD&gt;&lt;TD width="105.031px"&gt;100.0.1.0&lt;/TD&gt;&lt;TD width="77.2708px"&gt;Linux&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="103.031px"&gt;alb&lt;/TD&gt;&lt;TD width="105.031px"&gt;190.1.0.2&lt;/TD&gt;&lt;TD width="77.2708px"&gt;Windows&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="103.031px"&gt;cgf&lt;/TD&gt;&lt;TD width="105.031px"&gt;20.4.2.1&lt;/TD&gt;&lt;TD width="77.2708px"&gt;Windows&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="103.031px"&gt;bcn&lt;/TD&gt;&lt;TD width="105.031px"&gt;20.5.3.4, 30.4.6.1&lt;/TD&gt;&lt;TD width="77.2708px"&gt;Solaris&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Index B&lt;/P&gt;&lt;TABLE width="109"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="109"&gt;Hostname&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;zbc&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30.4.6.1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;alb&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;101.2.2.2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Results&lt;/P&gt;&lt;TABLE width="325px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="102.583px"&gt;Hostname&lt;/TD&gt;&lt;TD width="104.51px"&gt;IP address&lt;/TD&gt;&lt;TD width="77.2292px"&gt;OS&lt;/TD&gt;&lt;TD width="40.0104px"&gt;match&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="102.583px"&gt;xyz&lt;/TD&gt;&lt;TD width="104.51px"&gt;&lt;P&gt;190.1.1.1,&amp;nbsp; 101.2.2.2, 102.3.3.3, 4.3.2.1&lt;/P&gt;&lt;/TD&gt;&lt;TD width="77.2292px"&gt;&lt;P&gt;Windows&lt;/P&gt;&lt;/TD&gt;&lt;TD width="40.0104px"&gt;&lt;P&gt;ok(because IP address 101.2.2.2 is matching)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="102.583px"&gt;zbc&lt;/TD&gt;&lt;TD width="104.51px"&gt;100.0.1.0&lt;/TD&gt;&lt;TD width="77.2292px"&gt;Linux&lt;/TD&gt;&lt;TD width="40.0104px"&gt;ok&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="102.583px"&gt;alb&lt;/TD&gt;&lt;TD width="104.51px"&gt;190.1.0.2&lt;/TD&gt;&lt;TD width="77.2292px"&gt;Windows&lt;/TD&gt;&lt;TD width="40.0104px"&gt;ok&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="102.583px"&gt;cgf&lt;/TD&gt;&lt;TD width="104.51px"&gt;20.4.2.1&lt;/TD&gt;&lt;TD width="77.2292px"&gt;Windows&lt;/TD&gt;&lt;TD width="40.0104px"&gt;missing(neither hostname is present nor the IP is matching)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="102.583px"&gt;bcn&lt;/TD&gt;&lt;TD width="104.51px"&gt;20.5.3.4, 30.4.6.1&lt;/TD&gt;&lt;TD width="77.2292px"&gt;Solaris&lt;/TD&gt;&lt;TD width="40.0104px"&gt;yes(IP is matching)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;In my initial use case, I compared the hostnames in index A with those in index B. Now, I want to check if the hosts in index A are reporting their IP addresses in index B. If there’s a match, I will mark the corresponding hostname in index A as "ok."&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 10:12:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700185#M237636</guid>
      <dc:creator>Richy_s</dc:creator>
      <dc:date>2024-09-26T10:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two indexes and report on mismatch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700304#M237658</link>
      <description>&lt;P&gt;Assuming that, like in the OP, index A still carries Hostname field that you want to compare with Reporting_Host in index B. &amp;nbsp;In addition, index A has a field "IP address". &amp;nbsp;This should get your desired result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=A sourcetype="Any"
| stats values("IP address") as "IP address" by Hostname OS
| append
    [search index=B sourcetype="foo"
    | stats values(Reporting_Host) as Reporting_Host]
| eventstats values(eval(lower(Reporting_Host))) as Reporting_Host
| where index != "B"
| mvexpand "IP address"
| eval match = if(lower(Hostname) IN (Reporting_Host) OR 'IP address' IN (Reporting_Host), "ok", null())
| stats values("IP address") as "IP address" values(match) as match by Hostname OS
| fillnull match value="missing"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use the following emulation:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="Hostname,	IP address,	OS
xyz,	190.1.1.1:101.2.2.2:102.3.3.3:4.3.2.1,Windows
zbc,	100.0.1.0,	Linux
alb,	190.1.0.2,	Windows
cgf,	20.4.2.1,	Windows
bcn,	20.5.3.4:30.4.6.1,	Solaris"
| eval "IP address" = split('IP address', ":")
| eval index = "A"
| append
    [makeresults format=csv data="Reporting_Host
zbc
30.4.6.1
alb
101.2.2.2"
    | eval index = "B"]
``` the above emulates
index=A sourcetype="Any"
| stats values("IP address") as "IP address" by Hostname OS
| append
    [search index=B sourcetype="foo"
    | stats values(Reporting_Host) as Reporting_Host]
```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the result is&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Hostname&lt;/TD&gt;&lt;TD&gt;OS&lt;/TD&gt;&lt;TD&gt;IP address&lt;/TD&gt;&lt;TD&gt;match&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;alb&lt;/TD&gt;&lt;TD&gt;Windows&lt;/TD&gt;&lt;TD&gt;190.1.0.2&lt;/TD&gt;&lt;TD&gt;ok&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;bcn&lt;/TD&gt;&lt;TD&gt;Solaris&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;20.5.3.4&lt;/DIV&gt;&lt;DIV class=""&gt;30.4.6.1&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;ok&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;cgf&lt;/TD&gt;&lt;TD&gt;Windows&lt;/TD&gt;&lt;TD&gt;20.4.2.1&lt;/TD&gt;&lt;TD&gt;missing&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xyz&lt;/TD&gt;&lt;TD&gt;Windows&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;101.2.2.2&lt;/DIV&gt;&lt;DIV class=""&gt;102.3.3.3&lt;/DIV&gt;&lt;DIV class=""&gt;190.1.1.1&lt;/DIV&gt;&lt;DIV class=""&gt;4.3.2.1&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;ok&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;zbc&lt;/TD&gt;&lt;TD&gt;Linux&lt;/TD&gt;&lt;TD&gt;100.0.1.0&lt;/TD&gt;&lt;TD&gt;ok&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 27 Sep 2024 05:20:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700304#M237658</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-09-27T05:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two indexes and report on mismatch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700326#M237663</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;Thank you for your response.&amp;nbsp; I tried below query but it doesn't seem to be working.&amp;nbsp; When&amp;nbsp; I further cut down the query for testing, looks like "|where index!=B" is not working.&amp;nbsp; Everything before this query is working but when I add this condition, I get 0 results.&lt;/P&gt;&lt;P&gt;also, the query seems to be very aggressive.&amp;nbsp; My index A has almost close to 70k events and index B has around 10k events.&amp;nbsp; Splunk was crashing few times when I try to run the query.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions, how to address this ?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 10:15:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700326#M237663</guid>
      <dc:creator>Richy_s</dc:creator>
      <dc:date>2024-09-27T10:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two indexes and report on mismatch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700404#M237679</link>
      <description>&lt;P&gt;My apologies. &amp;nbsp;I was switching between two different approaches and the filters got crossed. &amp;nbsp;To use the subsearch method above, modify that line to &lt;FONT face="courier new,courier"&gt;| where isnotnull(OS)&lt;/FONT&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=A sourcetype="Any"
| stats values("IP address") as "IP address" by Hostname OS
| append
    [search index=B sourcetype="foo"
    | stats values(Reporting_Host) as Reporting_Host]
| eventstats values(eval(lower(Reporting_Host))) as Reporting_Host
| where isnotnull(OS)
| mvexpand "IP address"
| eval match = if(lower(Hostname) IN (Reporting_Host) OR 'IP address' IN (Reporting_Host), "ok", null())
| stats values("IP address") as "IP address" values(match) as match by Hostname OS
| fillnull match value="missing"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Depending on your deployment, combining the two index searches could improve performance, like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=A sourcetype="Any") OR (index=B sourcetype="foo")
| eventstats values(eval(lower(Reporting_Host))) as Reporting_Host
| where index != "B"
| mvexpand "IP address"
| eval match = if(lower(Hostname) IN (Reporting_Host) OR 'IP address' IN (Reporting_Host), "ok", null())
| stats values("IP address") as "IP address" values(match) as match by Hostname OS
| fillnull match value="missing"&lt;/LI-CODE&gt;&lt;P&gt;But eventstats and mvexpand could be bigger performance hindrances. &amp;nbsp;There could be ways to avoid mvexpand; there could be ways to improve eventstats. &amp;nbsp;But unless you can isolate the main contributor to slowness, they are not worth exploring.&lt;/P&gt;&lt;P&gt;Performance is a complex subject with any querying language. &amp;nbsp;You can start by doing some basic tests. &amp;nbsp;For example, run those two subsearches separately and compare with combined search. &amp;nbsp;If the total time is comparable, index search is the main hindrance. &amp;nbsp;That will be very difficult to improve. &amp;nbsp;Another test could be to add dedup before stats. &amp;nbsp;And so on.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2024 05:05:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700404#M237679</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-09-28T05:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two indexes and report on mismatch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700882#M237780</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp; Unfortunately none of the below queries are working for me.&amp;nbsp; First one is crashing splunk so unable to test it.&amp;nbsp; Second one, I don't get any results.&amp;nbsp; Could be because the field "Reporting_Host" is present only in index B and since we are excluding index B in the next step, the results are 0.&amp;nbsp; However I tried renaming the Hostname field in index A and try running the query but no results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can we test this scenario using a look up table, that might improve the search performance.&amp;nbsp; Can you give me something in this regards?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2024 13:16:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700882#M237780</guid>
      <dc:creator>Richy_s</dc:creator>
      <dc:date>2024-10-03T13:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two indexes and report on mismatch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700887#M237783</link>
      <description>&lt;P&gt;Something like this&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=B | stats count by Reporting_Host | search NOT [| inputlookup inventory.csv ] | table Hostname ]&lt;/LI-CODE&gt;
&lt;P&gt;inventory.csv has the table pickup from index A.&amp;nbsp; Lookup query is - index=B | stats values(IP address) by Hostname Operating_system&lt;/P&gt;
&lt;P&gt;PS This query is not working, just a thought.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2024 14:15:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700887#M237783</guid>
      <dc:creator>Richy_s</dc:creator>
      <dc:date>2024-10-03T14:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two indexes and report on mismatch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700969#M237810</link>
      <description>&lt;P&gt;You said crash several times. &amp;nbsp;This makes me think that your server may not have enough memory for that giant eventstats. (Again, this all depends on how many&amp;nbsp;&lt;EM&gt;unique&lt;/EM&gt; host name and IP addresses are in those tens of thousands of events. &amp;nbsp;If that number is unusually large, it could exceed system RAM. &amp;nbsp;But it also makes me suspect that your search heads might be under provisioned.)&lt;/P&gt;&lt;P&gt;If you are willing to use inventory lookup, things can improve. &amp;nbsp;Given that only one field from index B is useful in your logic, inventory should come from this index. (You also said index B is smaller.)&lt;/P&gt;&lt;P&gt;Here is my suggested setup for inventory.csv.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index = B sourcetype="foo"
| dedup Reporting_Host
| table Reporting_Host
| outputlookup inventory.csv&lt;/LI-CODE&gt;&lt;P&gt;After this,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=A sourcetype="Any"
| fields "IP address" Hostname OS
| dedup "IP address" Hostname OS
| eval Hostname = lower(Hostname)
| lookup inventory.csv Reporting_Host as Hostname output Reporting_Host as match
| lookup inventory.csv Reporting_Host as "IP address" output Reporting_Host as match
| eval match = if(isnull(match), "missing", "ok")
| table Hostname	"IP address"	OS	match&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 04 Oct 2024 05:07:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/700969#M237810</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-10-04T05:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two indexes and report on mismatch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/701028#M237829</link>
      <description>&lt;P&gt;&lt;BR /&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your feedback! I will definitely look into the performance issue and plan for further improvements.&lt;/P&gt;&lt;P&gt;Regarding the query, I tried it out, and here’s how it’s working: Index A contains around 70k assets, which serves as our asset inventory. Some hosts in this index have multiple IP addresses assigned to them. Index B has just the hostname, but this can include a mix of IP addresses, FQDNs, and hostnames.&lt;/P&gt;&lt;P&gt;When I ran the query, the first lookup compared the Reporting_Host with the hostnames in Index A and determined whether there was a match. The second lookup compared the Reporting_Host against the IP addresses in Index A to check for matches. However, when we combined these lookups as shown in the query you shared, the results only reflected matches from the second lookup, meaning only the IP addresses were being compared. Additionally, since a host in Index A has multiple IP addresses, the query gives a match for the IP address that corresponds, but for the remaining IP addresses associated with that host, it shows them as missing.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2024 17:15:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/701028#M237829</guid>
      <dc:creator>Richy_s</dc:creator>
      <dc:date>2024-10-04T17:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two indexes and report on mismatch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/701036#M237831</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;when we combined these lookups as shown in the query you shared, the results only reflected matches from the second lookup, meaning only the IP addresses were being compared. Additionally,&amp;nbsp;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;My mistake again. &amp;nbsp;When using the same output name, the second lookup overrides the first. &amp;nbsp;Use outputnew in the second.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=A sourcetype="Any"
| fields "IP address" Hostname OS
| dedup "IP address" Hostname OS
| eval Hostname = lower(Hostname)
| lookup inventory.csv Reporting_Host as Hostname output Reporting_Host as match
| lookup inventory.csv Reporting_Host as "IP address" OUTPUTNEW Reporting_Host as match
| eval match = if(isnull(match), "missing", "ok")
| table Hostname	"IP address"	OS	match&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2024 17:28:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-indexes-and-report-on-mismatch/m-p/701036#M237831</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-10-04T17:28:32Z</dc:date>
    </item>
  </channel>
</rss>

