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.
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...