Splunk Search

Comparing two values

lemikg
Communicator

Hi everybody,

I am trying to compare two values which would be the network interfaces (MAC, em1, em2) and depending on the result I want to output true or false. Up until now I only came up with a workaround.

But I am sure there is a prettier and a more efficient way for what I intend to do.

sourcetype=interfaces 
| multikv | table host Name MAC em1 inetAddr inet6Addr RXbytes TXbytes Speed Duplex
| eval bonded = if(em1 == MAC, "YES", "NO")
| table host Name MAC inetAddr inet6Addr RXbytes TXbytes Speed Duplex bonded

Hopefully somebody can point me at the right direction.

Thanks in advance any help would be much appreciated.

Best regards from Germany

Mike

0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

I'm not sure what you want to do differently, in order to compare two fields and produce "YES" or "NO" you won't get around comparing them and listing "YES" and "NO" in the branches.

You should however be able to ditch the first table command.

PS: If you need German support I'm sure we can work something out 🙂

View solution in original post

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

I'm not sure what you want to do differently, in order to compare two fields and produce "YES" or "NO" you won't get around comparing them and listing "YES" and "NO" in the branches.

You should however be able to ditch the first table command.

PS: If you need German support I'm sure we can work something out 🙂

0 Karma

lemikg
Communicator

Hi Martin,
thanks for your reply. That is exactly what I was aiming for.
Regards,
Mike
PS: Danke für den Hinweis bzgl. des Supports.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Kick the Tires Before You Commit: A Hands-On Tour of the Splunk Observability Cloud ...

Evaluating an enterprise observability platform usually goes like this: fill out a form, get a free trial with ...

Deep insights, no barriers: Splunk Observability Cloud Free Edition

As software delivery cycles continue to accelerate, observability shouldn’t be a luxury — it should be a ...

Monitoring AI Agents with Splunk Observability Cloud

Let’s say I’m running a travel planning AI app in production. A user asks for three concise hotel options in ...