This article provides steps to determine which user deleted a virtual machine or removed a virtual machine from the vCenter Server inventory.
VMware vCenter Server
To identify the user who removed or deleted a virtual machine, review the vCenter Server events and logs corresponding to the time of the deletion. The investigation can be performed from either the ESXi host logs or the vCenter Server logs.
Note: Log files in vCenter Server are subject to rotation. If the deletion event occurred outside the current retention period, the logs may no longer be available. It is recommended to investigate deletion events as soon as they are detected.
Use this method for centralized investigation of vCenter-level events.
journalctl | grep -i "VmRemovedEvent"YYYY MM DD hh:mm:ss <vc fqdn> vpxd[##]: Event [##] [1-1] [YYYY MM DD hh:mm:ss] [vim.event.VmRemovedEvent] [info] [domain\user] [datacenter-#] [##] [Removed bootstrap-vm-<vm name> on <esxi fqdn> from datacenter-##]Use this method if the VM removal occurred on a specific ESXi host.
Note: If the VM was deleted via vCenter Server, the ESXi log will show the user as vpxuser. To find the specific Active Directory or SSO user, you must check the vCenter Server logs (Method 2).
cd /var/run/log/grep -i "Destroy VM called" hostd*YYYY-MM-DD hh:mm:ss In(166) Hostd[#####]: [Originator@## sub=Vmsvc.vm:/vmfs/volumes/datastore/VM Name/VM name.vmx opID=#### sid=#### user=vpxuser:domain\Administrator] Destroy VM calledYYYY-MM-DD hh:mm:ss In(166) Hostd[#####]: [Originator@## sub=Vmsvc.vm:/vmfs/volumes/datastore/VM Name/VM name.vmx opID=#### sid=#### user=vpxuser:domain\Administrator] State Transition (VM_STATE_OFF -> VM_STATE_DELETING)YYYY-MM-DD hh:mm:ss In(166) Hostd[#####]: [Originator@## sub=Vmsvc.vm:/vmfs/volumes/datastore/VM Name/VM name.vmx opID=#### sid=#### user=vpxuser:domain\Administrator] Destroy VM completeFor deletions triggered by service accounts, API calls, or automated tools, you must correlate the session ID to a network source IP to reach a conclusive finding.