Nigel Boulton's Blog

Configuring Syslog for all your vSphere Hosts using PowerCLI

If you have a need to configure remote Syslog logging for all (or perhaps a subset) of your vSphere hosts at the same time, PowerCLI can help!

Let's assume that your remote Syslog server has the IP address Using the following PowerCLI one-liner, you can configure all hosts managed by a particular vCenter to send Syslog data to this server:

Get-VMHost | Set-VMHostSysLogServer -SysLogServer -SysLogServerPort 514

To configure only the hosts in a particular cluster to do this, you would use:

Get-Cluster 'Cluster Name' | Get-VMHost | Set-VMHostSysLogServer -SysLogServer -SysLogServerPort 514

The above assumes that you are using the vSphere PowerCLI console, and have already connected to the appropriate vCenter server as so:

Connect-VIServer -Server

Easy! Automation really is great…

Comments (5) Trackbacks (0)
  1. Don’t forget to enable the firewall exception when doing this.

    • Thanks for your comment Joe.

      I should have mentioned that I was doing this on ESXi 4.1, where firewall exceptions are not an issue. To do the same in 5.0 I think you would need:

      Get-VMHost | Set-VMHostAdvancedConfiguration -Name -Value

      Followed by:

      Get-VMHost | Get-VMHostFirewallException | where {$_.Name.StartsWith('syslog')} | Set-VMHostFirewallException -Enabled $true            
  2. Excellent stuff Nigel – getting round to upgrading to ESXi5.1, and updating the server build scripts!

Leave a comment

No trackbacks yet.