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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...