Product Announcements

Viewing ESXi Logs From the DCUI

Posted 28 June 2012 by Kyle Gleed, Sr. Technical Marketing Architect, VMware

I recently had a customer ask if I had any tips for viewing log files from the DCUI.  He mentioned that he was recently trying to track down an issue but struggled with using the DCUI "View System Logs" feature.  He commented that it was painful having to scroll through the files using the arrow keys and that he wasn't able to make any sense out of the help screen.  He was a long time Windows admin who had never worked with UNIX/Linux and was not was not familiar with the "vi" like interface used by the "less" editor, which is used to view log files from the DCUI.  As I'm sure he's not the only one who's been frustrated by this I thought it would be nice to give a quick tutorial on how to navigate log files using the DCUI.


When you logon to the DCUI  there is an option to “View System Logs”.  When you select this option you are given of list of log files that you can view by selecting the number corresponding to each log. 

  K1

When you select a log file you are switched to a log view with the contents of the log file displayed on the screen.  The interface used to display the log files is called “less” and uses a "vi" like syntax.  While the interface is not difficult to use, I wouldn't call it intuitive.  There is a help option (type “H”) but that can be a bit intimidating as you end up looking at what my customer called "a lot of gibberish":

K2

The good news is that "less" is very easy to learn and depite having a lot of different commands, you really only need to understand a few basic things in order to become proficient.  Below is an overview of the basic commands you need to know in order to get started:

Jumping to the top/bottom: 

When you first open a log file you always start at the top of the file, but most times what you really want to see is at or near the bottom (recent entries).  As such, in many cases the first thing you’ll usually want to do is jump to the bottom of the file, to do this simply type a capital ‘G” (think “G” as in GO). 

While a capital “G” takes you to the bottom of the file, a lowercase “g” will take you back to the top of the file.  Where this comes in handy is if you want to jump back to the top so you can search for the first occurrence of an error or warning in the file. 

You can also go to a specific line number in the file by specifying the line number followed by the letter “g”.  For example, if you're on the phone with support and they says "there's an error on line 823", you can jump right to line 823 by typing the number "823" followed by the letter "g".  Note that when you type the number it is displayed at the bottom of the screen after the semi-colon.  

K3

Scrolling through the file:

When viewing log files you’ll need to do a lot of scrolling.  If your keyboard has arrow keys you can use them, however some laptop keyboards don't have have arrow keys.  To scroll through the file you need to learn to use the “j”, “k”,  “f”, and “b” keys. 

  • To scroll down one line at a time type  “j” 
  • To scroll up one line at a time type “k”
  • To scroll down one page at a time type “f”
  • To scroll back one page at a time type “b”

Searching for text: 

Log files are big which makes it difficult to find things just by scrolling up and down.  As such, you will typically do a lot of searches looking for specific strings such as “Error” or “Warning”.  There are two ways to search for strings:

  • To do a forward search you simply type the forward slash  (/) followed by the string you want to search for – e.g. “/Warning”.  This will start the search from your current location and search down the file for any instances of the search string.
  • Sometimes, you will want to search backwards through a file.  To do a reverse search you use question mark “?” instead of the forward slash “/” – e.g. “?Warning”

When searching for strings note that you can repeat the search by simply tying “n” to go to the next occurrence.  Also, note that searching is case sensitive so when looking for errors I typically will do many searches, for example “/error”, “/Error” and “/ERROR”.

There are several other useful "less" commands you can use to navigate around your log files, but I’ve covered the basics of navigation, scrolling and searching and with this you should be able to get started.  To put all this in context here's an example of the steps what I will typically walk through anytime I access log files using the DCUI:

  • Login to the DCUI and select “View System Logs”
  • Type the number corresponding to the log file I want to view
  • Type “Shift-G” to jump to the bottom.
  • If I’m just perusing the file to see if there is anything of significance I'll start by pressing the “b” key to  scroll back through the log one page at a time. When I find something interesting I switch to the “k” and "j" keys to scroll one line at a time. 
  • If I’m looking for any errors or warnings, I'll jump to the bottom of the file and do a backward search by typing “?error” ( remember searches are case sensitive so you'll want to do multiple searches looking for different spellings – i.e.  “?Error” and “?ERROR).  If I get a hit on a search string I'll repeat the search by typing “n”.  Once I get to a section of the log that is interesting I then use the "j" and "k" keys to scroll up and and down.
  • Once I'm done viewing the file I simply type “q” (quit) to return to the DCUI view logs screen.

I hope this quick overview will help you in your efforts to use the DCUI to manage your ESXi hosts and view log files.  I hope you'll agree that viewing logs from the DCUI is pretty easy once you get a handle on the basics of navigating, scrolling and searching.

Follow me on twitter @VMwareESXi