Configuring syslog on ESXi 5.x and 6.0 (2003322)
vmsyslogd) that provides a standard mechanism for logging messages from the VMkernel and other system components. By default in ESXi, these logs are placed on a local scratch volume or a ramdisk. To preserve the logs further, ESXi can be configured to place these logs to an alternate storage location on disk and to send the logs across the network to a syslog server.
Retention, rotation, and splitting of logs received and managed by a syslog server are fully controlled by that syslog server. ESXi 5.x and 6.0 cannot configure or control log management on a remote syslog server. For more information, see the documentation for the syslog server.
Configuration of the syslog service on ESXi 5.x and 6.0 can be performed using Host Profiles, the vCLI, or the Advanced Configuration options in the vSphere Client.
Select the most appropriate method for your environment. Configuration cannot be performed by running the
A location on a local or remote datastore and path where logs are saved to. Has the format
||A comma-delimited list of remote servers where logs are sent using the syslog protocol. If the |
||A boolean option which controls whether a host-specific directory is created within the configured |
||The maximum number of log files to keep locally on the ESXi host in the configured logDir. Does not affect remote syslog server retention. Defaults to |
The maximum size, in kilobytes, of each local log file before it is rotated. Does not affect remote syslog server retention. Defaults to
Configuring Local and Remote Logging using the esxcli command
Local and Remote syslog functionality can be configured for a host using the esxcli command line utility, which can be used at the console of an ESXi host, in the vCLI, or in the vMA.
For more information regarding the use of esxcli , see the vSphere Command-Line Interface Documentation.
- Open a ESXi Shell console session where the
esxclicommand is available, such as the vCLI or on the ESXi host directly.
- Display the existing five configuration options on the host by running the command:
esxcli system syslog config get
- Set new host configuration, specifying options to change, by running a command:
Caution: Entering incorrect information for the logging path can cause the destination system to become unmanageable.
esxcli system syslog config set --logdir= /path/to/vmfs/directory/ --loghost= RemoteHostname --logdir-unique=true|false --default-rotate= NNN --default-size= NNN
To configure remote syslog using TCP on port 514:
esxcli system syslog config set --loghost='tcp://10.11.12.13:514'
To configure remote syslog using UDP on port 514:
esxcli system syslog config set --loghost='udp://10.11.12.13:514'Note: In ESXi 5.0, you must download a patch on the ESXi host if you are using syslog with UDP. For more information, see VMware ESXi 5.0, Patch ESXi-5.0.0-20120704001-standard (2019113).
- After making configuration changes, load the new configuration by running the command:
esxcli system syslog reloadNote: This command may be used to restart the syslog service if and when the service is stopped.
- Run this command to test if the port is reachable from the ESXi host:
nc -z RemoteHostname 514
nc -z 10.11.12.13 514
Configuring Local and Remote logging using Host ProfilesLocal and Remote syslog functionality can be configured for a cluster of similar hosts using Host Profiles. For more information, see the Set Up Syslog from the Host Profiles Interface section in the vSphere Installation and Setup Guide.
- Connect to the vCenter Server using the vSphere Client.
- Click Home.
- Under the Management section, click Host Profiles.
- Create a new profile or edit an existing profile.
- In the Edit Profile dialog, set one or more of the five configuration options.
- If you configured syslog using
esxclior advanced configuration options and captured this as a reference host, the 5 configuration options are already visible under the Advanced Configuration option section.
- If syslog has not been previously configured, right-click the Advanced Configuration options section and add a profile for each of the five configuration options.
- If you configured syslog using
- Save the profile and assign it to hosts.
Configuring Local and Remote Logging using Advanced Configuration options
esxcfg-advcfgcommand. For more information on setting advanced configuration options using each method, see Configuring advanced options for ESX/ESXi (1038578).
Note: If the host loses communication with the remote syslog server. Logging stops being pushed to the syslog server. You see the failed to write log error in the /var/log/.vmsyslogd.err file. Nothing is sent to the remote syslog server until the syslogd service is restarted.
Configuring ESXi Firewall Exception using the esxcli commandNote: You may need to manually open the Firewall rule set for syslog when redirecting logs. For UDP traffic, this firewall rule has no effect in ESXi 5.0 build 456551 and the UDP port 514 traffic flows regardless.
To open outbound traffic through the ESXi Firewall on UDP port 514, TCP port 514, and 1514, by running these commands:
esxcli network firewall ruleset set --ruleset-id=syslog --enabled=true
esxcli network firewall refresh
- Alternatively, you can modify the global log unique location per host from the command prompt. For more information, see Installing the HA Agent fails on all hosts, except one (2010648) and Restarting the Management agents on an ESXi or ESX host (1003490).
- For the VMware Syslog Service in vCenter Server 6.0, see the VMware Syslog Service section in the ESXi and vCenter Server 6.0 Documentation Guide.