carbonbase
asked on
how to list past events for a vmware virtual machine
Hi I'd like to see all migration events for a particular virtual machine, as we are trying to troubleshoot performance issues are being caused whenever DRS moves it between hosts.
I have the following code which pulls off all the events for a specific virtual machine but it only returns the same number of events I can see in the vCenter html5 client, 41 events.
I have the following code which pulls off all the events for a specific virtual machine but it only returns the same number of events I can see in the vCenter html5 client, 41 events.
$fileName = $env:Temp + '\report.csv'
$entity = Get-VM -Name my-vm
$events = Get-VIEvent -Entity $entity -MaxSamples 1000 | Select CreatedTime,UserName,FullFormattedMessage | Export-Csv -Path $fileName -NoTypeInformation -UseCulture
The vm has been around for a while so I would have thought there were more events than that. In the vSphere flash based web client you could export all events between specific dates, I know there isn't that feature in the html5 client but is it possible to do this in the vSphere power cli?ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you want to view older tasks and events, set to > 30.
ASKER
Thanks Andrew. I think for the time being we are ok with only retaining 30 days worth of logging, but it's good to know where that setting is in case we need to change it.
np
ASKER
My retention is set to 30 days. I've checked a few different vm's and I've seen a couple with events going back to the 6th April so I guess that's right then.