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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.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 ...