Splunk Search

How can i create a "key" for two searches and combine them to one search with a new column by "key"

i17065
Engager

Hello community i hope you can help me, I'm new here...
The field "moid" for 'folder' has the same values like the field changeSet.parent.moid for 'VMs'.
I want a new column with changeSet.name from 'folder' in the 'VMs' search where changeSet.parent.moid of 'VMs' and moid of 'folder' should be used as "key" to store the folder name to the VMs.
I have tried many things ("inner join" ect.), but did not get a useful result.
Maybe you can help me with a command.
Thank you in advance!
Greetings Lars

Selected Fields for 'folder':

a changeSet.name 100+ = foldername
a index 1 = vmware-inv
a moid 100+ = values
a sourcetype 1 = vmware:inv:hierarchy
a type 1 = folder

index="vmware-inv" sourcetype=vmware:inv:hierarchy
"changeSet.name"="* - *" AND "changeSet.name"!="*Failover*"
| fields changeSet.name, moid
| rename moid as folder_moid
| stats  values(changeSet.name) as folder by folder_moid
| sort folder

Selected Fields for 'VMs':

a changeSet.config.version 7
a cluster_name 79
a hypervisor_name 100+
a hypervisor_os_version 3

logical_cpu_count 44

tools_version 35

a vCenter 17

VM_DatastoreUsage 100+

VM_DatastoreUsageGB 100+

a vm_name 100+
a vm_os 37
a changeSet.parent.moid

index="vmware-inv" sourcetype = vmware:inv:vm OR vmware:inv:hierarchy 
| fields + _time,   changeSet.summary.runtime.host.name, 
changeSet.storage.perDatastoreUsage{}.committed, changeSet.config.name, vm_name, mem_capacity, 
logical_cpu_count, vm_os, hypervisor_name, cluster_name, host, hypervisor_os_version, 
changeSet.summary.runtime.powerState, changeSet.summary.vm.moid, changeSet.parent.moid  
| rename changeSet.summary.runtime.powerState as PowerState, 
changeSet.storage.perDatastoreUsage{}.committed as VM_DatastoreUsage, host as vCenter, 
changeSet.summary.vm.moid as VM_moid 
| mvexpand VM_DatastoreUsage 
| eval VM_mem_capacityGB= round(mem_capacity/1024/1024/1024,2), 
VM_DatastoreUsageGB=round(VM_DatastoreUsage/1024/1024/1024,2) 
| stats latest(cluster_name) as Cluster, latest(hypervisor_name) as ESXiHost, 
latest(hypervisor_os_version) as ESXiHost_os_version, latest(vm_name) as VM_Name, 
latest(VM_DatastoreUsageGB) as VM_DatastoreUsageGB, latest(VM_mem_capacityGB) as VM_mem_capacityGB,
latest(logical_cpu_count) as vCPU, latest(PowerState) as PowerState, 
latest(vm_os) as VM_OS, latest(_time) as _time by VM_moid, vCenter 
| sort ... 
| fields - ...
Tags (1)
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...