Splunk Search

Search two fields with same name but different values

gbwilson
Path Finder

I'm trying to create a stats table in Splunk that shows the IP of VMs and the IP of the Host that supports those VMs. Hosts and VMs have been indexed separately. Both indexes have the same field name 'IP.'

(index="cms_vm") OR (index="cms_host") Host=$hostnamefield$ IP=$ipfield$
| dedup VM
| table VM IP MacAddress OperatingSystem_Code Cluster Host B
| fields VM

Where the last field says 'B' I want to see the IP address of the Host, but because there's an IP field in the VM index nothing is returned. Also I want the token to search the IP of the Host not the VM.

0 Karma

pradeepkumarg
Influencer

Something like this


(index="cms_vm") host=$hostnamefield$ IP=$ipfield$ | append [ (index="cms_host") host=$hostnamefield$ IP=$ipfield$ | rename IP as host_ip] | stats values(IP) as VM_IP values(host_ip) as HOST_IP values(MacAddress) as MacAddress values(OperatingSystem_Code ) as OperatingSystem_Code values(Cluster) as Cluster by host

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...