<?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: compair list of hosts in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-of-hosts/m-p/483802#M193372</link>
    <description>&lt;P&gt;@acfecondo75&lt;BR /&gt;
I created the .csv file and uploaded. when running the search you provided I get an error "Error in 'from' command: invalid dataset specifier 'host', expected dataset-type:dataset-name&lt;/P&gt;

&lt;P&gt;any ideas?&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jan 2020 20:54:45 GMT</pubDate>
    <dc:creator>vlape_SCWX</dc:creator>
    <dc:date>2020-01-21T20:54:45Z</dc:date>
    <item>
      <title>How to compare list of hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-of-hosts/m-p/483798#M193368</link>
      <description>&lt;P&gt;I have a large amount of hostnames and IP's (approx. 1850) I need to validate are sending logs to Splunk. I do not believe I have access to create a list within Splunk (basic user access). Besides querying one by one, is there a way to craft a query to check for hosts reporting and create a table of items not found? Much appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 16:05:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-of-hosts/m-p/483798#M193368</guid>
      <dc:creator>vlape_SCWX</dc:creator>
      <dc:date>2021-05-25T16:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: compair list of hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-of-hosts/m-p/483799#M193369</link>
      <description>&lt;P&gt;HI @vlape_SCWX,&lt;BR /&gt;
I think that all these servers has an Universal Forwarder and send logs to Splunk.&lt;BR /&gt;
So you should create a lookup containing all the hosts to monitor (called e.g. perimeter.csv) containing at least a column (called e.g. hostname) and then run a search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metasearch index=_internal
| eval host=lower(host)
| stats count BY host
| append [ | inputlookup perimeter.csv | eval host=lower(hostname), count=0 | fields host count ]
| stats sum(count) AS total BY host
| where total=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that you can schedule (e.g. every five minutes) in an alert.&lt;BR /&gt;
In this way you have all the hosts that didn't send logs in tha last period.&lt;/P&gt;

&lt;P&gt;If you like, you can also display this list in a dashboard, without the last row and adding&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metasearch index=_internal
| eval host=lower(host)
| stats count BY host
| append [ | inputlookup perimeter.csv | eval host=lower(hostname), count=0 | fields host count ]
| stats sum(count) AS total BY host
| eval Status=if(total=0,"Missing","OK")
| table host Status
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this way: hosts with total=0 are missing and hosts with total&amp;gt;0 are ok; this dashboard is also displayable in graphic format (with a red or green circle).&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 13:02:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-of-hosts/m-p/483799#M193369</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-01-16T13:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: compair list of hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-of-hosts/m-p/483800#M193370</link>
      <description>&lt;P&gt;hi @vlape_SCWX,&lt;/P&gt;

&lt;P&gt;even with basic user access, you do have permission to create a list (lookup in splunk terms). This comes with the input_file capability that is given to every out-of-the-box role in Splunk. The easiest way to create the lookup would be via the lookup file editor app (&lt;A href="https://splunkbase.splunk.com/app/1724/"&gt;https://splunkbase.splunk.com/app/1724/&lt;/A&gt;), if it's installed. If it is not, I'd recommend requesting that it be installed!&lt;/P&gt;

&lt;P&gt;If the lookup editor app is not an option, you can upload the file (in csv format) via Settings-&amp;gt;Lookups-&amp;gt;Add New (Next to lookup files). This doc outlines the process more thoroughly: &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/Knowledge/Usefieldlookupstoaddinformationtoyourevents"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.1/Knowledge/Usefieldlookupstoaddinformationtoyourevents&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;Once you have the lookup, you output the hosts from the lookup using the inputlookup command. Then perform a left join which will run a subsearch and add the fields from the subsearch to your results by matching the field specified (in this case, host). Then look for instances where the count field is null:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    | inputlookup hostlookup.csv
    | eval host=lower(host)
    | join type=left host
    | [tstats count by host | eval host=lower(host)]
    | where isnull(count)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;*the field that you join on IS case sensitive so it's a good idea to use evals to force the field values to be in the same format.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 13:54:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-of-hosts/m-p/483800#M193370</guid>
      <dc:creator>acfecondo75</dc:creator>
      <dc:date>2020-01-16T13:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: compair list of hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-of-hosts/m-p/483801#M193371</link>
      <description>&lt;P&gt;If you still find that you are struggling with this objective, you can run a search, download the reulting "spreadsheet" and perform your comparison in excel or whatever similar tool you have available. Here is a sample search that should get you the hosts sending data to splunk:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|tstats count where index=* by host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Jan 2020 15:24:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-of-hosts/m-p/483801#M193371</guid>
      <dc:creator>mydog8it</dc:creator>
      <dc:date>2020-01-16T15:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: compair list of hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-of-hosts/m-p/483802#M193372</link>
      <description>&lt;P&gt;@acfecondo75&lt;BR /&gt;
I created the .csv file and uploaded. when running the search you provided I get an error "Error in 'from' command: invalid dataset specifier 'host', expected dataset-type:dataset-name&lt;/P&gt;

&lt;P&gt;any ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 20:54:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-of-hosts/m-p/483802#M193372</guid>
      <dc:creator>vlape_SCWX</dc:creator>
      <dc:date>2020-01-21T20:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: compair list of hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-of-hosts/m-p/483803#M193373</link>
      <description>&lt;P&gt;I've never seen that  error so I don't know for sure. I would need to see the contents of the lookup and the exact search you ran to figure out what caused it.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 19:24:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-of-hosts/m-p/483803#M193373</guid>
      <dc:creator>acfecondo75</dc:creator>
      <dc:date>2020-01-23T19:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: compair list of hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-of-hosts/m-p/483804#M193374</link>
      <description>&lt;P&gt;@acfecondo75 &lt;BR /&gt;
The lookup is a csv file named C_Hosts.csv. the forst 4 rows look like:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;host&lt;/LI&gt;
&lt;LI&gt;server1&lt;/LI&gt;
&lt;LI&gt;server2&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;server3&lt;BR /&gt;
The search is:&lt;/P&gt;

&lt;P&gt;| inputlookup C_Hosts.csv&lt;BR /&gt;
| eval host=lower(host)&lt;BR /&gt;
| join type=left host&lt;BR /&gt;
| [tstats count by host | eval host=lower(host)]&lt;BR /&gt;
| where isnull(count)&lt;BR /&gt;
Does that help?&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Fri, 24 Jan 2020 19:35:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-list-of-hosts/m-p/483804#M193374</guid>
      <dc:creator>vlape_SCWX</dc:creator>
      <dc:date>2020-01-24T19:35:29Z</dc:date>
    </item>
  </channel>
</rss>

