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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...