Splunk Search

How to compare two field values from one index to another index

praveenm00
New Member

Hello Experts, We are having an issue where we are having two indexes named monitor and poll. Below is the structure of both the indexes.

Monitor:
hostname,ip_address,monitored,tool
poll:
machinename, lastpoll

Our requirement is to take each hostname from monitor index and compare with poll index and if hostname(monitor) matches with machinename(poll) then it has to list all the fields from both the index.

How can we achieve it. Kindly help us.

Thanks

Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Here's one approach.

index=monitor OR index=poll 
| eval machine=coalesce(hostname, machinename) 
| stats values(ip_address) as ip_address, values(monitored) as monitored, values(tool) as tool, values(lastpoll) as lastpoll by machine
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...