Splunk Search

Compare inputlookup and index search

Scroogemcdougal
Engager

Hi,

I have a lookupfile that contains a list of hosts, (one column named hosts), this list maybe subject to change.

I want to complete a search that will compare this lookup file to hosts in any specific index and return a table showing ok or missing if there is no match.

All searches I have attempted so far are happy to return either or, is the only option here to rename the field in the hostfile or any suggestions on how to complete this?

host (from lookup file)host (from index)match
host1host1ok
host2 missing
host3host3ok




Labels (5)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
search index
| table host
| dedup host
| append
  [ | inputlookup lookupfile
    | table host
    | dedup host ]
| stats count by host
| eval match=if(count=1, "missing", "ok")

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
search index
| table host
| dedup host
| append
  [ | inputlookup lookupfile
    | table host
    | dedup host ]
| stats count by host
| eval match=if(count=1, "missing", "ok")

Scroogemcdougal
Engager

Hey man,

Thanks so much for this worked an absolute charm

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...