6.0

VMware, Inc. 11
Command-Line Management in vSphere 5 and vSphere 6 for Service Console Users
esxcli system syslog Examples
Thefollowingworkflowillustrateshowyoumightuseesxcli system syslogforlogconfiguration.
1Showconfigurationoptions.
esxcli system syslog config get
Default Rotation Size: 1024
Default Rotations: 8
Log Output: /scratch/log
Logto Unique Subdirectory: false
Remote Host: <none>
2Setalllogstokeeptwentyversions,thenstartoverwritingtheoldestlog.
esxcli system syslog config set --default-rotate=20
3SettherotationpolicyforVMkernellogsto10rotations,rotatingat2MB.
esxcli system syslog config logger --id=vmkernel --size=2048 --rotate=10
4Sendlogstoremotehostmyhost.mycompany.com.ThelogswillusethedefaultUDPport,514.
esxcli system syslog config set --loghost='myhost.mycompany.com'
5Sendlogs/scratch/mylogsontheremotehostmyhost.mycompany.comusingTCP/IPport1514.
esxcli system syslog config set --loghost='tcp://myhost.mycompany.com:1514'
--logdir='/scratch/mylogs'
6Sendalogmessageintoalllogssimultaneously.
esxcli system syslog mark --message="this is a message!"
7Reloadthesyslogdaemonandapplyconfigurationchanges.
esxcli system syslog reload
Viewing Logs in the ESXi Shell
IntheESX4.xshell,thelocationforlogsis/var/log.IntheESXiShell,youcanalsofindallcurrentlogsinthe
/var/logdirectory.Someofthelogsaresymboliclinkstothe/var/run/logdirectory.
Table 3. esxcli syslog Options
Option Description
mark Markalllogswiththespecifiedstring.
reload Reloadtheconfigurationandupdateanyconfigurationva lues thathavechanged.
config get Retrievethecurrentconfiguration.
config set Settheconfiguration.Useoneofthefollowingoptions.
--logdir=<path>Savelogstoagivenpath.
--loghost=<host>Sendlogstoagivenhost(seediscussiononloghostformat
below)
--logdir-unique=<true|false>Specifywhetherthelogshouldgotoaunique
subdirectoryofthedirectoryspecifiedinlogdir.
--default-rotate=<int>Defaultnumberoflogrotationstokeep
--default-size=<int>Sizebeforerotatinglogs,inkilobytes.
config logger list Showcurrentlyconfiguredsub-loggers.
config logger set Setconfigurationoptionsforaspecificsublogger.Useoneofthefollowingoptions:
--id=<str>IDoftheloggertoconfigure(required)
--reset=<str>Resetvaluestodefault
--rotate=<long>Numberofrotatedlogstokeepforaspecificlogger(requires
--id)
--size=<long>Setsizeoflogsbeforerotationforaspecificlogger,inkilobytes
(requires--id)