<?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 How to compare list with lookup? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-with-lookup/m-p/521373#M146922</link>
    <description>&lt;P&gt;Hi all, I'm trying to compare list of apps by server with a list of apps in lookup to find if its installed or not. I tried Join and append, its not working. Please advise.&lt;/P&gt;&lt;P&gt;|inputlookup app_list.csv| table app_name&lt;/P&gt;&lt;P&gt;index=test | table system app_name | stats values(app_name) by system| append [|inputlookup app_list.csv| table app_name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Sep 2020 20:57:18 GMT</pubDate>
    <dc:creator>knalla</dc:creator>
    <dc:date>2020-09-24T20:57:18Z</dc:date>
    <item>
      <title>How to compare list with lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-with-lookup/m-p/521373#M146922</link>
      <description>&lt;P&gt;Hi all, I'm trying to compare list of apps by server with a list of apps in lookup to find if its installed or not. I tried Join and append, its not working. Please advise.&lt;/P&gt;&lt;P&gt;|inputlookup app_list.csv| table app_name&lt;/P&gt;&lt;P&gt;index=test | table system app_name | stats values(app_name) by system| append [|inputlookup app_list.csv| table app_name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 20:57:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-with-lookup/m-p/521373#M146922</guid>
      <dc:creator>knalla</dc:creator>
      <dc:date>2020-09-24T20:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare list with lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-with-lookup/m-p/521382#M146924</link>
      <description>&lt;P&gt;If I understand your question correctly, you are looking to see if your index data for any given server contains the apps in the lookup, so you are trying to check a negative state in your data, so if you have the lookup containing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;app_name
app_1
app_2
app_3&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and your test index events have rows like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;system=sys_1, app_name=app_1
system=sys_2, app_name=app_1
system=sys_3, app_name=app_1
system=sys_2, app_name=app_2
system=sys_1, app_name=app_3
system=sys_3, app_name=app_3&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you would want to see&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;system    Apps      Status
system_1  app1      installed
          app2      missing
          app3      installed
system_2  app1      installed
          app2      installed
          app3      missing
system_3  app1      installed
          app2      missing
          app3      installed&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then this should do the trick&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test 
| stats count by system app_name 
| append [
  | inputlookup app_list.csv
  | eval system="__"
  | rename app_name as wanted_app_name
  | table system wanted_app_name
]
| stats list(wanted_app_name) as wanted_app_name list(app_name) as app_name by system
| filldown wanted_app_name
| where system!="__"
| mvexpand wanted_app_name
| eval installed=if(!isnull(mvfind(app_name, wanted_app_name)), "installed", "missing")
| stats list(wanted_app_name) as Apps list(installed) as Status by system&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;collects the apps from the index data by system&lt;/LI&gt;&lt;LI&gt;Appends all apps from file and makes a single field with all apps&lt;/LI&gt;&lt;LI&gt;which is then copies to all data rows (filldown)&lt;/LI&gt;&lt;LI&gt;expands that wanted_apps list (mvexpand)&lt;/LI&gt;&lt;LI&gt;checks if each of those wanted apps is found in the apps from the data (mvfind)&lt;/LI&gt;&lt;LI&gt;uses stats list to list the apps and their status&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Note that the stats list operation only supports 100 items, so you cannot have more than 100 apps in this case.&lt;/P&gt;&lt;P&gt;stats values will not work unless you do some additional processing to stitch up the app/status&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 22:28:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-with-lookup/m-p/521382#M146924</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-09-24T22:28:42Z</dc:date>
    </item>
  </channel>
</rss>

