Information
Configure VM settings to prevent uncontrolled logging. Virtual machines write
troubleshooting information into a virtual machine log file stored on the VMFS volume.
Virtual machine users and processes can abuse logging either on purpose or inadvertently
so that large amounts of data flood the log file. Over time, the log file can consume enough
file system space to cause a denial of service.
*Rationale*
You can use log settings to limit the total size and number of log files. Normally a new log
file is created only when a host is rebooted, so the file can grow to be quite large. You can
ensure that new log files are created more frequently by limiting the maximum size of the
log files. If you want to restrict the total size of logging data, VMware recommends saving
10 log files, each one limited to 1,000KB (1,024,000 bytes). Datastores are likely to be
formatted with a block size of 2MB or 4MB, so a size limit too far below this size would
result in unnecessary storage utilization. Each time an entry is written to the log, the size of
the log is checked; if it is over the limit, the next entry is written to a new log. If the
maximum number of log files already exists, when a new one is created, the oldest log file is
deleted. A denial-of-service attack that avoids these limits might be attempted by writing
an enormous log entry. But each log entry is limited to 4KB, so no log files are ever more
than 4KB larger than the configured limit. A second option is to disable logging for the
virtual machine. Disabling logging for a virtual machine makes troubleshooting challenging
and support difficult. You should not consider disabling logging unless the log file rotation
approach proves insufficient. Uncontrolled logging can lead to denial of service due to the
datastores being filled.
Solution
To implement the recommended configuration state, run the following PowerCLI
command-# Add the setting to all VMs
Get-VM | New-AdvancedSetting -Name 'log.rotateSize' -value '1024000'
Impact-A more extreme strategy is to disable logging altogether for the virtual machine. Disabling
logging makes troubleshooting challenging and support difficult. Do not consider disabling
logging unless the log file rotation approach proves insufficient.
Default Value-The prescribed state is not the default state.