Let’s say that we would like to change the syslog server to which our esxi5 boxes is sending logs in some particular cluster.
[sourcecode language=”powershell”]
$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)
}
[/sourcecode]
Now check if we have updated values
[sourcecode language=”powershell”]
get-view -viewtype HostSystem -SearchRoot (get-cluster "our-cluster").id | % { get-view $_.ConfigManager.AdvancedOption | select -ExpandProperty Setting |?{$_.Key -like "Syslog.global.logHost"} }
[/sourcecode]
Many thanks to LucD for pointing me out a better way to go with updating this value!
2 comments
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!
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.