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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...