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!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...