Home > Blogs > VMware vSphere Blog


Log Insight bulk ESXi host configuration with PowerCLI

Recently I installed vCenter Log Insight, which by the way has one of the easiest and intuitive installers and configuration wizards ever!

After the Install and during the configuration you can easily add your vCenter server and vCOPs server so that monitoring can start straight away.

As an extra configuration step you can extend the default logging by setting up each ESXi host to use the Syslog server which is built into Log Insight, the process for this can be found in the documentation located here.

As per the documentation this means either going to each host and configuring the Syslog settings, configuring them manually through the shell or running the configure-esxi script through an SSH session.

As I already had a PowerCLI session open to my environment I wrote a quick PowerCLI script to achieve the same thing, the following script will configure the Syslog settings for each ESXi host to send their events to Log Insight…..

Connect to your vCenter Server and then change the IP address in the first line of the script below:

$LogInsightServer = “10.20.182.60″
Get-VMHost | Foreach {
    Write-Host “Adding $LogInsightServer as Syslog server for $($_.Name)”
    $SetSyslog = Set-VMHostSysLogServer -SysLogServer $LogInsightServer -SysLogServerPort 514 -VMHost $_
    Write-Host “Reloading Syslog on $($_.Name)”
    $Reload = (Get-ESXCLI -VMHost $_).System.Syslog.reload()
    Write-Host “Setting firewall to allow Syslog out of $($_)”
    $FW = $_ | Get-VMHostFirewallException | Where {$_.Name -eq ‘syslog’} | Set-VMHostFirewallException -Enabled:$true
}

Example screenshot

Example

Find out more about Log Insight

To find out more information about Log Insight check out their page here or watch the overview video below.

This entry was posted in Automation and tagged , on by .
Alan Renouf

About Alan Renouf

Alan Renouf is a Product Manager at VMware focusing on Automation Frameworks and CLI, he is responsible for providing the architects and operators of the cloud infrastructure with the toolkits/frameworks and command-line interfaces they require to build a fully automated software-defined datacenter. Alan is a frequent blogger at http://blogs.vmware.com/PowerCLI and has a personal blog at http://virtu-al.net. You can follow Alan on twitter as @alanrenouf.

4 thoughts on “Log Insight bulk ESXi host configuration with PowerCLI

  1. Pingback: ESXi, syslog and logins | VMware vSphere Blog - VMware Blogs

  2. Virtual Vizior

    Hi Alan,
    Thanks for sharing another great script which can save lot of our time.
    May be if we can check the ESX server version before applying the firewall property would be helpful.
    We are running ESXi as the hyperversor, getting below given error messages while running this script.

    “Get-VMHostFirewallException This version of ESX Server has no firewall itself therefore firewall management is not supported.”

Comments are closed.