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 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...