Virtual machines can write support and troubleshooting information into a virtual machine log file stored on a VMFS volume.

The default settings for virtual machines are appropriate for most situations.

If your environment relies heavily on using vMotion, or if the defaults do not seem suitable for other reasons, you can modify the logging settings for virtual machine guest operating systems.

A new log file is ALWAYS created during virtual machine power-on, resume, migration with vMotion, and so on.

You can further adjust the amount of log data generated by a virtual machine by making adjustments to two parameters:
  • vmx.log.keepOld: The number of log files retained per virtual machine is controlled by the vmx.log.keepOld property.
    Note: VMware recommends saving a minimum of 10 log files. If you need log files for a longer time span, you can set vmx.log.keepOld to 20 or more.
  • vmx.log.rotateSize: The maximum size of each log file, in bytes, is controlled by vmx.log.rotateSize property.
    To ensure that a new log file is created more frequently, you can limit the maximum size of the log files with this configuration parameter. Each time an entry is written to the log, the size of the log is checked. If vmx.log.rotateSize is set to a non default value, and the size is over the limit, the next entry is written to a new log file. If the maximum number of log files exists, the oldest log file is deleted.
    Note: If this parameter is used, VMware recommends setting it to a minimum of 2000000 bytes.

The total amount of storage space consumed by all the log files is the product of these two parameters.

These settings may be set on an individual virtual machine basis or for all virtual machines on an ESXi host.

The following procedure discusses limiting the amount of virtual machine log data for all virtual machines on an ESXi host:
  • To place limits on the amount of virtual machine log data, edit /etc/vmware/config
  • If the vmx.log.keepOld and vmx.log.rotateSize properties are not defined in the file, add them.

For example, to retain ten log files, each one no larger than 2000000 bytes, add the following to /etc/vmware/config:

vmx.log.keepOld = "10"

vmx.log.rotateSize = "2000000"

The maximum amount of storage space consumed by each virtual machine is 10 * 2000000 bytes.

Note:

You can use a PowerCLI script to change these properties for all the virtual machines on a host.