We recently noticed some hosts in our environment that show an alert triggered by ‘Status of other host hardware objects’. Upon further investigation it turned out that this was caused by the system event log (SEL) that is about to run out of space.

Now if you don’t mind not having a bit of history of your hardware-related events you can easily clear it and there’s even a function in vCenter that lets you do that. However it turns out that – at least in vCenter 6.7 U2 – the reset function doesn’t actually perform a reset but a refresh instead.

Using the code capture shows this behavior. And this clearly NOT what we intended.

Luckily the vSphere Web Services API documentation clearly shows that there’s a ClearSystemEventLog method. So what’s to stop us from writing a simple PowerCLI function? Well……. actually nothing.

Once you enter this function in a powershell session and log on to your vCenter you can pass a list of ESXi hosts to this function with Get-VMHost and it will clear the system event log. Just like this.

Enjoy!

Share this if you found this interesting.

Leave a Reply

Your email address will not be published. Required fields are marked *