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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...