Splunk Enterprise

How do I compare a lookup with a search?

mokabe
New Member

I wanted to compare a Lookup with a Search:

Ex:

Lookup "list_host_lookup.csv"

Server
AA
BB
CC
DD
EE
FF
GG

Search
index=abcddf sourcetype
| dedup Host
| table HOST STATUS

HOST STATUS

AA Active
BB Active
CC Off
DD Active
GG Off
HH Active
II Off

If the lookup host (list_host_lookup.csv) is not in the Search or if it is in the Search and is "Off", create a "NOK" field.
If the lookup host (list_host_lookup.csv) is in the Search or if it is in the Search and is "Active", create an "OK" field.

Labels (1)
0 Karma

dural_yyz
Communicator
| inputlookup list_host_lookup.csv
| join
[ search index=abcddf sourcetype
| stats latest(Status) as Status by host]
| table host Status
| eval new_field=case(Status="Active",OK)
| fillnull value=NOK new_field

Use this as a starting point but you may find a desire to edit and customize as you see fit.

0 Karma
Get Updates on the Splunk Community!

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 ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...