Syslog configuration from esxcli

So I install a lot of ESX on Cisco UCS booting off of internal SD cards and as you may know in the world of vSphere; SD cards, USB drives and boot from ISCSI LUNs are all considered non-persistent storage. So it’s always been common practice to create a log directory on a shared datastore and change the Local Log Output parameter under Advanced setting to point to the new directory. I’ve always done this in the vSphere client I recently had to change this for 75 or so hosts. I was not in a position to use Host Profiles so I decided to figure out how I could do this via esxcli. It just figures, after getting about halfway through the process on my own I came across the Vmware KB2003322.

 

The three commands are as follows:

esxcli system syslog config get

esxcli system syslog config set –logdir=/vmfs/volumes/datastorename/esxhostname

esxcli system syslog reload

 

Example:

First confirm my existing settings:

[root@RPALAB-ESX02:~] esxcli system syslog config get

Default Network Retry Timeout: 180

Dropped Log File Rotation Size: 100

Dropped Log File Rotations: 10

Enforce SSLCertificates: false

Local Log Output: /scratch/log

Local Log Output Is Configured: false

Local Log Output Is Persistent: true

Local Logging Default Rotation Size: 1024

Local Logging Default Rotations: 8

Log To Unique Subdirectory: false

Message Queue Drop Mark: 90

Remote Host: <none>

Next set my new Local Log Output location

[root@RPALAB-ESX02:~] esxcli system syslog config set –logdir=/vmfs/volumes/3PAR-VMFS-Datastore01/raplab-esx02

Restart the syslog service

[root@RPALAB-ESX02::~] esxcli system syslog reload

Confirm my change took effect

[root@RPALAB-ESX02::~] esxcli system syslog config get

Default Network Retry Timeout: 180

Dropped Log File Rotation Size: 100

Dropped Log File Rotations: 10

Enforce SSLCertificates: false

Local Log Output: /vmfs/volumes/3PAR-VMFS-Datastore01/rpalab-esx02

Local Log Output Is Configured: true

Local Log Output Is Persistent: true

Local Logging Default Rotation Size: 1024

Local Logging Default Rotations: 8

Log To Unique Subdirectory: false

Message Queue Drop Mark: 90

Remote Host: <none>

If you want even more confirmation browse to the location & view the log files

[root@RPALAB-ESX02:/vmfs/volumes/5761771e-91187f21-5328-d4bed9ad7383/rpalab-esx02] ls

Xorg.log               fdm.log                osfsd.log              syslog.log             vmkwarning.log         vsanvpd.log

auth.log               hostd-probe.log        pktcap-agent.log       usb.log                vmsyslogd-dropped.log  vsfwd.log

clomd.log              hostd.log              rabbitmqproxy.log      vdpi.log               vobd.log               vvold.log

ddecomd.log            hostprofiletrace.log   rhttpproxy.log         vmauthd.log            vprobe.log

dfwpktlogs.log         iofiltervpd.log        sdrsinjector.log       vmkdevmgr.log          vprobed.log

dhclient.log           lacp.log               shell.log              vmkernel.log           vpxa.log

epd.log                netcpa.log             storagerm.log          vmkeventd.log          vsanmgmt.log

esxupdate.log          nfcd.log               swapobjd.log           vmksummary.log         vsantraceUrgent.log

Leave a Reply

Your email address will not be published. Required fields are marked *