Customer SupportShop

Configure VMware virtual machine log rotation

Set a size limit and retention count for a VM’s vmware.log files, then verify that rotation behaves as expected.

Legacy platform guidance for existing VMware environments.

Applies to: vSphere virtual machines managed with a compatible PowerCLI release.

Before you start

  • Choose a single test VM and record its current advanced settings. Agree retention with your support and diagnostic requirements.
  • Connect to the correct vCenter using an account authorised to change VM settings.

Procedure

  1. Select the VM explicitly. Use a resource-pool or cluster scope only after reviewing every VM in that scope.
  2. Create missing advanced settings or update existing settings. The example uses five retained files and a 1 MiB rotation threshold; these are example values.
  3. Follow the vendor guidance for when changes take effect on your release, including any required VM power cycle.

PowerCLI example

Connect-VIServer -Server 'vcenter.example.com'
$vm = Get-VM -Name 'Example-VM' -ErrorAction Stop
if (@($vm).Count -ne 1) { throw 'Select exactly one VM.' }
$settings = @{ 'log.keepOld' = '5'; 'log.rotateSize' = '1048576' }
foreach ($name in $settings.Keys) {
    $existing = Get-AdvancedSetting -Entity $vm -Name $name -ErrorAction SilentlyContinue
    if ($existing) {
        $existing | Set-AdvancedSetting -Value $settings[$name] -Confirm:$true -ErrorAction Stop
    } else {
        New-AdvancedSetting -Entity $vm -Name $name -Value $settings[$name] -Confirm:$true -ErrorAction Stop
    }
}
Get-AdvancedSetting -Entity $vm -Name 'log.keepOld','log.rotateSize'

Check the result

  • Read back both settings and inspect the VM directory after sufficient log activity.
  • Confirm useful diagnostic history is retained. This controls VM logs, not the ESXi host’s syslog retention.