Change the syslog server for esxi5 box using powercli


Let’s say that we would like to change the syslog server to which our esxi5 boxes is sending logs in some particular cluster.

$changedValue = New-Object VMware.Vim.OptionValue[] (1)
$changedValue[0] = New-Object VMware.Vim.OptionValue
 $changedValue[0].key = "Syslog.global.logHost"
 $changedValue[0].value = "tcp:/your-syslog-ip:514"

Get-View -ViewType HostSystem -Searchroot (Get-Cluster "your-cluster-name").Id | %{
  $optMgr = Get-View $_.ConfigManager.AdvancedOption
  $optMgr.UpdateOptions($changedValue)
}

Now check if we have updated values

get-view -viewtype HostSystem -SearchRoot (get-cluster "our-cluster").id | % { get-view $_.ConfigManager.AdvancedOption | select -ExpandProperty Setting |?{$_.Key -like "Syslog.global.logHost"} }

Many thanks to LucD for pointing me out a better way to go with updating this value!

Advertisements

2 thoughts on “Change the syslog server for esxi5 box using powercli

  1. I just like the helpful info you provide on your articles. I’ll bookmark your weblog and test once more right here regularly. I am rather sure I will be told plenty of new stuff right right here! Best of luck for the next!

  2. You might want to change tcp:/your-syslog-ip:514 to udp:/your-syslog-ip:514.

    When using TCP if the syslog server goes down at all (i.e Microsoft patching) then your syslog stops on the esx hosts and does not restart automatically when the syslog host comes back. and you have to restart syslog on each esx host.. (powercli can help here).

    If you use udp then the syslog doesn’t stop on the esx if the syslog server is stopped.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s