Here’s a quick bit of PowerCLI to configure syslog server on all hosts, place each hosts logs in a unique directory, and then enable the firewall exception to allow it to be used. This will do every host in the vCenter you’re connected to. I highly recommend that anyone managing a vSphere environment set up a syslog destination for ESXi. There’s nothing more frustrating than attempting root-cause analysis on a failure when logs aren’t persistent and in a central location.

Cheers!

[code language=”ps”] #Get all ESXi hosts$hosts = Get-VMHost

#Update Syslog configuration

$hosts | Set-VMHostAdvancedConfiguration Syslog.global.logHost -Value 0.0.0.0

$hosts | Set-VMHostAdvancedConfiguration Syslog.global.logDirUnique -Value True

#Enable firewall exception

$hosts | Get-VMHostFirewallException | where {$_.Name.StartsWith(‘syslog’)} |

Set-VMHostFirewallException -Enabled $true

[/code]