Splunk Search

Need help to comparing two pieces of information from two different hosts

murilocepeda
Engager

how can I compare information from two different hosts?

For exemple, On a host I have the name, number and phone calls. In another I have Name, number, phone calls and location.

Can I compare the two information based on logic? Example: if phone calls (host1) = 0 and phone calls (host2) = 0, status = ok

my logic

index=zzzz host=yyyy or host=xxxxx | name, phone_call, location
eval description=case(phone_call(host1) == 0 AND phone(call(host2) == 0, "ok") | table description

 

Thanks, sorry  for my bad english

Labels (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

To be compared, data must be in the same event.  You can combine events from different hosts/sources with the stats command.

index=zzzz (host=yyyy OR host=xxxxx)
| eval phone_call1 = if(host="yyyy", phone_call), phone_call2 = if(host="xxxxx", phone_call)
| stats values(*) as * by number
| eval description=if(phone_call1==0 AND phone_call2==0, "OK", "Not OK")
| table description
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

To be compared, data must be in the same event.  You can combine events from different hosts/sources with the stats command.

index=zzzz (host=yyyy OR host=xxxxx)
| eval phone_call1 = if(host="yyyy", phone_call), phone_call2 = if(host="xxxxx", phone_call)
| stats values(*) as * by number
| eval description=if(phone_call1==0 AND phone_call2==0, "OK", "Not OK")
| table description
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI! Discover how Splunk’s agentic AI ...

[Puzzles] Solve, Learn, Repeat: Dereferencing XML to Fixed-length events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Stay Connected: Your Guide to December Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...