Splunk Search

Eval variable1=variable2 is True or False?

starks951
Explorer

Folks... I am extracting two variables at search time and trying to report when the two variables are not the same. At this point the two variables are host (coming from the splunk LF running on the system) and os_hostname (coming from a script that calls hostname on a linux box). Basically I want to know when host!=os_hostname and report on that. We have some admins that are cloning servers and forgetting to re-install Splunk so all the cloned systems are reporting as if they were the original cloned system.

I assume there is a way to do this with the Eval command, but can't seem to find the right syntax. Can someone help me?

Tags (1)

carasso
Splunk Employee
Splunk Employee

If you really just want to know when host!=os_hostname, just use

       ... | where host!=os_hostname 
0 Karma

gkanapathy
Splunk Employee
Splunk Employee
... | eval state=if(host!=os_hostname,"bad","good")

gkanapathy
Splunk Employee
Splunk Employee

if(lower(host)!=lower(os_hostname),...)

0 Karma

starks951
Explorer

This works GREAT... any way to make it more fuzzy so it doesn't care about capital letters, IE host=computera and os_hostname=COMPUTERA ?

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