Archive for Logs

Configure VMware vMA as an ESXi 4 Syslog Server

magglass

Configure VMware vMA as an ESXi 4 Syslog Server

A lot of people don’t know you can set up vMA as a Syslog Server in vSphere ESXi 4. vSphere 5 has the built-in SysLog Installation but what do you do if you’re running vSphere 4?

Pre Requisites

  • VMware vMA

Instructions

Step 1 – Deploy a vMA Server

  • Deploy a vMA Server in vCenter. Follow this link for full instructions
  • Specify the Hostname, IP address, Subnet Mask, Default gateway and DNS information
  • Specify a Password for the vi-admin account

Step 2 – Configure Time

ESXi uses UTC for internal time stamping. In order to avoid timestamp issues the vMA should be set to UTC for time keeping. When vMA collects the logs from your ESXi Host, sometimes the logs have the ESXi Host timestamp and sometimes they will have the vMA Localtime timestamp

  • Remove the Local Time
  • sudo rm /etc/localtime
  • Create a symbolic link to the UTC timezone
  • sudo ln –s /usr/share/zoneinfo/UTC /etc/localtime
  • Edit the NTP configuration file. Find the section # Use public servers from the pool.ntp.org project and replace the current entries with your preferred NTP servers
  • sudo nano /etc/ntp.conf
  • Configure the NTP daemon to start on reboot
  • sudo /sbin/chkconfig ntpd on
  • Restart the NTP daemon:
  • sudo /sbin/service ntpd restart
  • Confirm the NTP server connections are up
  • sudo ntpq -np
  • Change the keyboard to English if required in the location below. Change KEYTABLES=”us” to use the keyboard you have, for example: KEYTABLES=”en”
  • sudo vi /etc/sysconfig/keyboard

Step 3 – Add additional Storage to the vMA

  • Shutdown the vMA VM
  • Attach an additional disk to the VM. Choose how big you want it. A very rough estimate of the amount of log information captured would be 500MB per host, per day.
  • Power on vMA
  • Login in using vi-admin
  • Format the new Disk with the following command
  • fdisk /dev/sdb
  • Use the n command to create a new partition
  • Use the p command to make the new partition a primary partition
  • Press 1 to make it partition #1
  • Use the default for the First Cylinder
  • Use the default for the Last Cylinder
  • Use the p command to verify the partition table
  • Use the w command to write the partition table to the hard disk
  • Press Enter a couple of times to confirm it’s finished and return to the command prompt
  • Now we need to format the partition using the follow command
  • sudo mkfs -t ext3 /dev/sdb1

Step 4 – Mount the Disk

  • Edit /etc/fstab using the following command
  • nano /etc/fstab
  • Enter in the following line. Use tab to line up the entries
  • /dev/sdb1  /var/log/syslog  ext3  defaults,auto  1 2
  • Use Ctrl+X then Y to save the file
  • Next: cd /var/log/ then mkdir syslog
  • Change the owner of the /syslog dir
  • sudo chown vi-admin:root /var/log/syslog
  • finally mount the disk
  • mount /var/log/syslog

Step 5 – Edit the vilogger application file so it knows where to store the logfiles. The default location is /var.log/vmware which needs changing

  •  Edit the vilogger config file
  • sudo nano /etc/vmware/vMA/vMA.conf
  • Change the location entries (three of them) to <location>/var/log/syslog</location>
  • Use Ctrl+X then Y to save the file
  • Start (or restart) the vilogger daemon
  • sudo service vmware-vilogd start
  • Now vilogger is set to store the logs on to your new disk

Step 6 – Configure vMA to collect your logs

  •  Add the first host using fastpass authentication
  • vifp addserver –authpolicy fpauth
  • Add the second host, then the third host and all hosts you need before proceeding to the next step
  • Enter the root password when prompted
  • Verify the server has been added
  • vifp –listservers
  • Enable vilogging
  • vilogger enable –server –numrotation 20 –maxfilesize 10 –collectionperiod 300
  • To access the help type vilogger –help

ESXi logging collects 3 logs (vpxa.log, hostd.log, and messages.log). Rough math is number of logs X number of hosts X maxrotations X maxfilesizes = total MB for logs. You’ll need slightly more than that for vilogger’s logs (depending on where you placed those when you edited vMA.conf).

vilogger Options 

vilogger

Other Links

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1016621

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1024122

Viewing Web based ESXi Host Logs

animal Frog on log coloring pages

A quick way to view VMware ESXi logs is via a web browser. Just do the following

  • Open your favorite Web Browser
  • Enter the following: https://<esxi ip address>/host
  • Enter the ESXi Host Root username/password

You will see the following

log

ESX, ESXi and VM Log Locations

Logs can help you find out what happened if commands do not have the desired results. On ESXi 5.0 systems, find all logs in the /var/log directory. Some of the items in that directory are symbolic links from the /var/run/log directory.

On ESXi 4.1 systems, you can find the following logs.

Location of Log Files for VMware Products

http://kb.vmware.com/selfservice/documentLinkInt.do?micrositeID=&popup=true&languageId=&externalID=1021806

Host and VM Log Locations

Location

Component

 

/var/log/vmware/vmware-serverd.log ESX Server 2.x service log
var/log/vmware/hostd.log Host management service logs, including virtual machine and host Tasks and Events, communication with the vSphere Client and vCenter Server vpxa agent, and SDK connections.
/var/log/vmware/vpx/vpxa.log vSphere client agent log
After you reboot your machine, files /root/vmkernel-log.<date> and /root/vmkernel-core.<date> are present. Virtual machine kernel core file
/var/log/messages Messages from the Service Console Linux kernel, including service startup and shutdown.
/var/log/vmksummary Summary of ESX host startup and shutdown, and an hourly heartbeat with uptime, number of virtual machines running, and service console resource consumption
/var/log/vmkernel VMkernel messages, alerts, and availability report, Core VMkernel logs, including device discovery, storage and networking device and driver events, and virtual machine startup.
/var/log/vmkwarning Summary of Warning and Alert log messages excerpted from the VMkernel logs.
vmware.logIn the same directory as the VMX file for the virtual machine Virtual machine log file
/.vmx Located on a datastore associated with the managed host. Use the virtual machine summary page in the vSphere Client to determine the datastore on which this file is located. Virtual machine configuration file
var/log/boot-logs/sysboot.log Early VMkernel startup, module loading, and host initialization.
/var/log/vmkiscsid.log Software iSCSI Client logs.

vCenter Log Locations

/var/log/vmware/vpx/vpxa.log vCenter Server vpxa agent logs, including communication with vCenter Server and the Host Management hostd agent.
/var/log/vmware/fdm/* VMware High Availability Logs for vCenter Server 5
/var/log/vmware/aam/* VMware High Availability Logs for vCenter Server 4