<?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 compare a look up field with multivalued indexed data in splunk? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-look-up-field-with-multivalued-indexed-data-in/m-p/691878#M235541</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;for your insightful article that provided me with a good starting point.&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jun 2024 17:04:02 GMT</pubDate>
    <dc:creator>Richy_s</dc:creator>
    <dc:date>2024-06-27T17:04:02Z</dc:date>
    <item>
      <title>How to compare a look up field with multivalued indexed data in splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-look-up-field-with-multivalued-indexed-data-in/m-p/691651#M235494</link>
      <description>&lt;P&gt;I am trying to write a splunk query. I have asset inventory data with hostname and IP address(multivalued), one hostname will have multiple IP address. And I have indexed data in Splunk with a field called Hostname(this is mix of hostname and IP addresses of some random assets).&amp;nbsp; Now I need to compare the asset inventory data with the indexed data,&amp;nbsp; and the output should be hostname &amp;amp; IP address that is not present in the indexed data.&lt;/P&gt;
&lt;P&gt;Sample data -&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=asset_inventory | table hostname IPaddress&lt;/LI-CODE&gt;
&lt;P&gt;output&lt;/P&gt;
&lt;P&gt;hostname IPaddress&lt;/P&gt;
&lt;P&gt;abc 0.0.0.0&lt;/P&gt;
&lt;P&gt;abc 2.2.2.2&lt;/P&gt;
&lt;P&gt;abc 3.3.3.3&lt;/P&gt;
&lt;P&gt;def 1.1.1.1&lt;/P&gt;
&lt;P&gt;xyz 4.5.6.7&lt;/P&gt;
&lt;P&gt;Indexed data -&amp;nbsp;&lt;/P&gt;
&lt;P&gt;index=indexed_data | stats count by Reporting_Host&lt;/P&gt;
&lt;P&gt;Reporting_Host&lt;/P&gt;
&lt;P&gt;3.3.3.3&lt;/P&gt;
&lt;P&gt;def&lt;/P&gt;
&lt;P&gt;Expected output -&lt;/P&gt;
&lt;P&gt;Host_not_present&lt;/P&gt;
&lt;P&gt;xyz&lt;/P&gt;
&lt;P&gt;Can someone help with with a Splunk query to get desired output.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 12:05:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-look-up-field-with-multivalued-indexed-data-in/m-p/691651#M235494</guid>
      <dc:creator>Richy_s</dc:creator>
      <dc:date>2024-06-26T12:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a look up field with multivalued indexed data in splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-look-up-field-with-multivalued-indexed-data-in/m-p/691655#M235495</link>
      <description>&lt;P&gt;Finding something that is not there is not Splunk's strong suit.&amp;nbsp; See this blog entry for a good write-up on it.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.duanewaddle.com/proving-a-negative/" target="_blank"&gt;https://www.duanewaddle.com/proving-a-negative/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 12:09:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-look-up-field-with-multivalued-indexed-data-in/m-p/691655#M235495</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-06-26T12:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a look up field with multivalued indexed data in splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-look-up-field-with-multivalued-indexed-data-in/m-p/691717#M235509</link>
      <description>&lt;P&gt;Like&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;said, Splunk is not great at searching for for missing things. &amp;nbsp;Meanwhile, if you already have the inventory, there is something you can do.&lt;/P&gt;&lt;P&gt;Assuming lookup myinventory is in the form of&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;hostname&lt;/TD&gt;&lt;TD width="50%"&gt;IPaddress&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;abc&lt;/TD&gt;&lt;TD width="50%"&gt;0.0.0.0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;abc&lt;/TD&gt;&lt;TD&gt;2.2.2.2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xyz&lt;/TD&gt;&lt;TD&gt;4.5.6.7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;zab&lt;/TD&gt;&lt;TD&gt;7.8.9.10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;zab&lt;/TD&gt;&lt;TD&gt;6.7.8.9&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;and the requirement is to capture the following entries from the lookup where&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;hostname in this lookup has no matching entry with hostname in index search and&lt;/LI&gt;&lt;LI&gt;IPaddress in this lookup has no matching entry with IPaddress or hostname in index search.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;To make our task simpler, further assume that if an index search event matches anything in lookup, that hostname and/or IPaddress is/are no longer a candidate. &amp;nbsp;This is what you can try:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=asset_inventory
| stats values(hostname) as hostname values(IPaddress) as IPaddress
| appendcols
    [inputlookup myinventory
    | stats values(hostname) as lookupname values(IPaddress) as lookupaddress]
| eval missingname = mvmap(lookupname, if(lookupname != hostname, lookupname, null()))
| eval missingaddress = mvmap(lookupaddress, if(lookupaddress != IPaddress AND lookupaddress != hostname, missingaddress, null()))
| lookup myinventory IPaddress as missingaddress output hostname as addressmissingname
| eval missingname = mvappend(missingname, mvmap(addressmissingname, if(addressmissingname != hostname, addressmissingname, null())))
| table missingname&lt;/LI-CODE&gt;&lt;P&gt;Note:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;the search takes avdantage of Splunk's equality evaluation with multivalue.&lt;/LI&gt;&lt;LI&gt;this search becomes complicated because your index search may return IP address in hostname and apparently you care about those entries. &amp;nbsp;If we ignore those entries and only compare hostname hostnames with inventory, the search can be as simple as&lt;/LI&gt;&lt;/OL&gt;&lt;LI-CODE lang="markup"&gt;index=asset_inventory
| stats values(hostname) as hostname
| appendcols
    [inputlookup myinventory
    | stats values(hostname) as lookupname]
| eval missingname = mvmap(lookupname, if(lookupname != hostname, lookupname, null()))
| fields - hostname&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 17:27:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-look-up-field-with-multivalued-indexed-data-in/m-p/691717#M235509</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-06-26T17:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a look up field with multivalued indexed data in splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-look-up-field-with-multivalued-indexed-data-in/m-p/691878#M235541</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;for your insightful article that provided me with a good starting point.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 17:04:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-look-up-field-with-multivalued-indexed-data-in/m-p/691878#M235541</guid>
      <dc:creator>Richy_s</dc:creator>
      <dc:date>2024-06-27T17:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a look up field with multivalued indexed data in splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-look-up-field-with-multivalued-indexed-data-in/m-p/691879#M235542</link>
      <description>&lt;P class="lia-align-justify"&gt;Hello &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;, your suggestion was exactly what I needed. Thanks to your initial query, I was able to achieve the desired outcome with some adjustments. Your detailed explanation was greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 17:05:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-look-up-field-with-multivalued-indexed-data-in/m-p/691879#M235542</guid>
      <dc:creator>Richy_s</dc:creator>
      <dc:date>2024-06-27T17:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a look up field with multivalued indexed data in splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-look-up-field-with-multivalued-indexed-data-in/m-p/693951#M236058</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;&lt;/P&gt;&lt;P&gt;It seems that the current query is only retrieving results from the 'myinventory' lookup without performing the intended comparison with the 'asset_inventory' data. It appears that you need to modify the query such that it compares both datasets ('myinventory' and 'asset_inventory') and returns only the discrepancies between the two.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 11:12:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-look-up-field-with-multivalued-indexed-data-in/m-p/693951#M236058</guid>
      <dc:creator>Richy_s</dc:creator>
      <dc:date>2024-07-22T11:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a look up field with multivalued indexed data in splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-look-up-field-with-multivalued-indexed-data-in/m-p/694024#M236080</link>
      <description>&lt;P&gt;The problem is actually deeper because appendcols works only if the lookup and index search has the same number of rows (and sort order). &amp;nbsp;In this use case, that's opposite to the premise. &amp;nbsp;I will have to look deeper - but there should be something - it could be even more cumbersome.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 05:04:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-look-up-field-with-multivalued-indexed-data-in/m-p/694024#M236080</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-07-23T05:04:31Z</dc:date>
    </item>
  </channel>
</rss>

