Storing host logs on a shared datastore
ESXi server logs are stored locally by default on each host in the /var/log
directory. In certain cases, there is a requirement to store logs on a datastore.
Possible scenarios are hosts without local storage, where all locally stored logs disappear after reboot, compliance requirements where there is a requirement to store logs in an alternative location, or space concerns where there are many hosts and the administrator has to keep older logs.
How to do it...
vCenter allows redirecting ESXi logs to one of the datastores accessible to the host. This can be accomplished by going to Configuration | Advanced Settings | Syslog by changing the variable Syslog.global.logDir
to an appropriate value [Datastore]/Folder:
In vCenter Web Client, these options can be found by going to Host | Manage | Settings | Advanced System Settings, as shown in the following figure:
There's more…
Once this change is made, you will see log files created in the configured folder if you browse the datastore.
From the same Advanced Settings section, you can configure the additional logging options:
Option |
Description |
---|---|
|
If chosen the ESXi syslog will create a separate folder for this host in the specified logging folder. The folder will be named with the ESXi hostname. This option is helpful when the logging folder is shared between more than one host. |
|
This is the maximum number of log files to keep after rotation. |
|
This is the maximum log file size in kilobytes. Once reached, the log file will be rotated. |
The same logging parameters can also be configured from the ESXi command line using the esxcli system syslog
command.
For example, to validate logging settings configured from vCenter use:
esxcli system syslog config get
VMware KB 2003322 gives more details about configuring syslog, including CLI command sequence, which is available at http://kb.vmware.com/kb/2003322.