To prevent virtual machine users and processes from creating large numbers of log files, which can lead to denial of service, you can limit the number of the log files for a virtual machine. You cannot limit the log file size for individual virtual machines from the ESXi Shell. Using the vSphere Web Client instead is preferred.

You can limit the number of log files for all virtual machines on a host by editing the /etc/vmware/config file. If the vmx.log.KeepOld property is not defined in the file, you can add it. For example, to keep ten log files for each virtual machine, add the following to /etc/vmware/config:

vmx.log.keepOld = "10"

You can also use a PowerCLI script to change this property on all the virtual machines on a host.


Find the virtual machine configuration file, as follows:


Log in to a vCenter Server system using the vSphere Client.


On the Summary tab, click Edit Settings.


Select Options > General Options and make a record of the path displayed in the Virtual Machine Configuration File text box.


Log into the ESXi Shell as a user with administrator privileges.


Change directories to access the virtual machine configuration file whose path you recorded in Step GUID-0D3CFB73-9366-4A93-8737-78B6ECCECCBE.html#GUID-0D3CFB73-9366-4A93-8737-78B6ECCECCBE__STEP_DAD24A1BF4154864B84B6421B782193F.

Virtual machine configuration files are located in the /vmfs/volumes/datastore directory, where datastore is the name of the storage device on which the virtual machine files reside. For example, if the virtual machine configuration file you obtained from the Virtual Machine Properties dialog box is [vol1]vm-finance/vm-finance.vmx, you would change to the following directory.


To keep a limited number of log files, use a text editor to add or edit the following line to the .vmx file, where number_of_files_to_keep is the number of files the server keeps.


For example, to keep 8 log files and begin deleting the oldest ones as new ones are created, enter 8.


Save your changes and close the file.