<?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: identify host not in a list... in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/581991#M202729</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/238212"&gt;@sjringo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you have to pust the list of host to monitor in a lookup (called e.g. perimeter.csv), with at least one field (host), and run a search like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| metasearch index=_internal
| eval host=lower(host)
| stats count BY host
| append [ | inputlookup perimeter.csv | eval host=lower(host), count=0 | fields host count ]
| stats sum(count) AS total By host
| where total=0&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jan 2022 13:14:45 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2022-01-21T13:14:45Z</dc:date>
    <item>
      <title>identify host not in a list...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/581988#M202727</link>
      <description>&lt;P&gt;I have a query that returns a set of hosts that have an event string.&lt;/P&gt;&lt;P&gt;index=anIndex sourcetype=aSourceType ("aString1" AND ( host = "aHostName*"))&lt;/P&gt;&lt;P&gt;|&amp;nbsp; stats values(host) AS aServerList1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a list of servers ("Server1", "Server2", "Server3")&amp;nbsp; &amp;nbsp;&amp;lt;-&amp;nbsp; ServerList2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What im trying to do is to find servers/hosts that are not returned from the initial query.&lt;/P&gt;&lt;P&gt;i.e. hosts that exists in ServerList2 but are not in ServerList1 ?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 13:11:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/581988#M202727</guid>
      <dc:creator>sjringo</dc:creator>
      <dc:date>2022-01-21T13:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: identify host not in a list...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/581991#M202729</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/238212"&gt;@sjringo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you have to pust the list of host to monitor in a lookup (called e.g. perimeter.csv), with at least one field (host), and run a search like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| metasearch index=_internal
| eval host=lower(host)
| stats count BY host
| append [ | inputlookup perimeter.csv | eval host=lower(host), count=0 | fields host count ]
| stats sum(count) AS total By host
| where total=0&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 13:14:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/581991#M202729</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-01-21T13:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: identify host not in a list...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/581992#M202730</link>
      <description>&lt;P&gt;I saw a posting about using a .csv file but I cannot put a file on the Splunk server it all needs to be in the Splunk query.&lt;/P&gt;&lt;P&gt;I made an assumption that the .csv would reside on the Splunk server the query is being executed on.&lt;/P&gt;&lt;P&gt;I could use two queries as I have another query that gets a unique list of hosts that have splunk traffic.&lt;/P&gt;&lt;P&gt;Same concept, instead of hardcoded list of hosts the list of hosts is generated from a query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 13:20:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/581992#M202730</guid>
      <dc:creator>sjringo</dc:creator>
      <dc:date>2022-01-21T13:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: identify host not in a list...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/581997#M202732</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/238212"&gt;@sjringo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;putting the server list in the search it's possible if you have few server to monitor, otherwise it's complicated!&lt;/P&gt;&lt;P&gt;In this case, you could run something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| metasearch index=_internal host In (host1, host2, host3)
| stats count BY host
| append [ | makeresults | eval host=host1, count=0 | fields host count ]
| append [ | makeresults | eval host=host2, count=0 | fields host count ]
| append [ | makeresults | eval host=host3, count=0 | fields host count ]
| stats sum(count) AS total By host
| where total=0&lt;/LI-CODE&gt;&lt;P&gt;I hint to use the lookup!&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 13:31:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/581997#M202732</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-01-21T13:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: identify host not in a list...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582010#M202735</link>
      <description>&lt;P&gt;I did not think of comparing the results of two queries earlier and that would be a better solution:&lt;/P&gt;&lt;P&gt;If I have the following two lists of hosts:&lt;/P&gt;&lt;P&gt;index=anIndex sourcetype=aSourceType ("aString1" AND ( host = "aHostName*"))&lt;/P&gt;&lt;P&gt;|&amp;nbsp; stats values(host) AS aServerList1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=anIndex sourcetype=aSourceType ("aString2" AND ( host = "aHostName*"))&lt;/P&gt;&lt;P&gt;|&amp;nbsp; stats values(host) AS aServerList2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;aServerList2 would be my list of all hosts and would like to find those hosts that exists in aServerList2 but do not exist in aServerList1 ?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 14:24:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582010#M202735</guid>
      <dc:creator>sjringo</dc:creator>
      <dc:date>2022-01-21T14:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: identify host not in a list...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582016#M202738</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/238212"&gt;@sjringo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you could also use another search to have the list of servers to monitor, something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| metasearch index=_internal 
| stats count BY host
| append [ | metasearch index=_internal  earliest=-30d@d latest=now | stats count BY host | eval count=0 | fields host count]
| stats sum(count) AS total
| where total=0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but there's a limit in this solution: you could lack some servers because they aren't in the second list (they are missing in the last 30 days.&lt;/P&gt;&lt;P&gt;For this reason, I hinted to use a lookup with the list of servers to monitor.&lt;/P&gt;&lt;P&gt;Beware: if you use "value(host) As host", you have a multivalue field that you cannot use for monitoring.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 15:11:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582016#M202738</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-01-21T15:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: identify host not in a list...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582049#M202745</link>
      <description>&lt;P&gt;The metadata search, I dont think is what I want.&amp;nbsp; I found another post on set diff that compares two searches ? just having some troubles getting it to work.&lt;/P&gt;&lt;P&gt;The first query finds all hosts that have an event that matches "String1" and particular host name with a wildcard search.&lt;/P&gt;&lt;P&gt;Query 1:&lt;/P&gt;&lt;P&gt;search index=anIndex sourcetype=aSourceType ("String1" AND host="aHostName*") | stats count by host | table host&lt;/P&gt;&lt;P&gt;Query two finds all servers based on just the host name with a wild card search.&lt;/P&gt;&lt;P&gt;Query 2:&lt;/P&gt;&lt;P&gt;search index=anIndex sourcetype=aSourceType (host="aHostName*") | stats count by host | table host&lt;/P&gt;&lt;P&gt;Now my next step is to figure out how to get this to work with&amp;nbsp; | set diff? or is there another way to find what is missing when comparing the two tables ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 16:39:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582049#M202745</guid>
      <dc:creator>sjringo</dc:creator>
      <dc:date>2022-01-21T16:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: identify host not in a list...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582077#M202755</link>
      <description>&lt;P&gt;Here is my solution:&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;| set diff&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;[ | search index=anIndex sourcetype1=aSourceType ("aString1" AND (host="aHostName1*" OR host="aHostName2*"))&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;| stats count by host | table host ]&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;[ search index=anIndex sourcetype=aSourceType2 (host="aHostName1*" OR host="aHostName2*")&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;| stats count by host | table host ]&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 18:18:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582077#M202755</guid>
      <dc:creator>sjringo</dc:creator>
      <dc:date>2022-01-21T18:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: identify host not in a list...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582124#M202778</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/238212"&gt;@sjringo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;this solution is less efficient than mine, but if&amp;nbsp; you have the wanted results, you can use it; infact if you search in Community the most solutions are similar to mine.&lt;/P&gt;&lt;P&gt;In addition, using the "index=anindex" filter, you aren't sure of results because maybe a server could be missed in both the searches.&lt;/P&gt;&lt;P&gt;For this reason, I hint to use "index=_internal" because you're sure to have logs from active servers.&lt;/P&gt;&lt;P&gt;"| metadata" is a way to have a faster search but you cannot use it using words as a filter.&lt;/P&gt;&lt;P&gt;Ciao and happy spluking.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jan 2022 07:00:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582124#M202778</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-01-22T07:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: identify host not in a list...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582131#M202781</link>
      <description>&lt;P&gt;This method is indeed more efficient. &amp;nbsp;And it doesn't have to be complicated if&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/MultivalueEvalFunctions#mvappend.28X.2C....29" target="_self"&gt;mvappend(X,...)&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;is used.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=anIndex sourcetype=aSourceType ("aString1" AND ( host = "aHostName*"))
| stats values(host) as hosts by sourcetype ``` not strictly neccessary but makes subsequent search faster if the event list is large ```

| append 
    [ | makeresults
    | eval hosts = mvappend("Server1", "Server2", "Server3")
    ]
| stats values(sourcetype) as sources by hosts
| where isnull(sources)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The static server list can easily be extended.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jan 2022 09:15:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582131#M202781</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-01-22T09:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: identify host not in a list...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582141#M202783</link>
      <description>&lt;P&gt;My first goal was to get something to work I will look at your suggestion to see if I can incorporate or change over to use this.&amp;nbsp; I have around 25 servers that im trying to monitor.&lt;/P&gt;&lt;P&gt;Thanks for your input !&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jan 2022 10:57:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582141#M202783</guid>
      <dc:creator>sjringo</dc:creator>
      <dc:date>2022-01-22T10:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: identify host not in a list...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582142#M202784</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using index=anIndex cause I need to first search for a particular string to identify which servers log a&amp;nbsp;&lt;/P&gt;&lt;P&gt;known event.&amp;nbsp; I then compare against a list of 25 known servers that are logging splunk traffic.&lt;/P&gt;&lt;P&gt;I will see if I can use any of your suggestions in my next iteration of this.&lt;/P&gt;&lt;P&gt;Thanks for your input !&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jan 2022 11:00:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582142#M202784</guid>
      <dc:creator>sjringo</dc:creator>
      <dc:date>2022-01-22T11:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: identify host not in a list...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582207#M202805</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/238212"&gt;@sjringo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I hinted to use _internal instead of anindex because, to use anindex you must be sure that you always have logs in this index, instead using _internal, you're sure of the presence of logs because they are always generated by Splunk, if you haven't them it's the error condition you're searching.&lt;/P&gt;&lt;P&gt;Anyway, if you can I hint to use the lookup, to have more control on your monitoring, otherways une of the solutions hintd by myself or by&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;can be your solution.&lt;/P&gt;&lt;P&gt;Please, when you'll solve the problem accept one solution for the other people of Community.&lt;/P&gt;&lt;P&gt;Ciao and happy splunking.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the Contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 07:28:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/identify-host-not-in-a-list/m-p/582207#M202805</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-01-24T07:28:09Z</dc:date>
    </item>
  </channel>
</rss>

