Splunk Search

Compare field with lookup

mfritsch
New Member

Hi

I have a lookup table containg the host name and a software version

hostlookup.csv

hostname,version
hostA,2
hostB,2
hostC,3

Each host is sending the current installed software version each 5 min to splunk.

How can I create a table like this. I Iike to compare if a host has installed the right software version.

hostname, installed_version, expected_version, result
hostA, 2, 2, OK
hostB, 3, 2, WRONG
hostC, 2, 3, WRONG
0 Karma

HiroshiSatoh
Champion

Try this!

(your search)
|rename version as installed_version
|lookup hostname hostlookup.csv output version as expected_version]
|eval result=if(installed_version=expected_version,"OK","WRONG")
|table hostname, installed_version, expected_version, result

0 Karma

lauMarot
Path Finder

weird ... I see ] without a [

0 Karma

HiroshiSatoh
Champion

It is a typo.

as expected_version]

as expected_version

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...