Now Available:

Featured Resource:

line

Newsletter

Email Address:


line

Ask the Expert

Have a question for our resident expert? Email your questions to Greg.

« 10 Linux Commands Every Windows Admin Should Know - Part 5 of 10 - top | Main | 10 Linux Commands Every Windows Admin Should Know - Part 7 of 10 - init »

10 Linux Commands Every Windows Admin Should Know - Part 6 of 10 - dmesg and syslog

One of the most common tools you probably use for problem analysis is the Windows Event Logger. It can be a pretty useful graphical tool, but the Linux world was built around the command-line so it instead gets the text-based dmesg.

dmesg displays the last set of system messages. If you run this shortly after a reboot, it will display kernel boot messages. In it you will see extreme levels of detail about various devices, drivers, and other kernel-level initializations. This can be fairly verbose, more so than even the messages you see when you boot Windows in debug mode. The information in each is functionally the same. They are designed to show you what the kernel is doing.

In Linux, dmesg provides a glimpse into a 16KB slice of kernel memory reserved for such messages. When that space has been filled up with messages, the log loops and new messages are written to the beginning which overwrites earlier messages. This is important because while dmesg shows you everything in chronological order, if your system has been up for a while the boot messages may have been lost.

To assist with this looping situation, Linux also has the syslog. Syslog is a Linux service that begins its life early in the boot process, and its role is to funnel messages into long-term storage from other services or applications. Invariably, these files are found somewhere in /var, a common Linux directory tree used to store "variable" data. Lots of things live in /var, like the system logs in /var/log, crash dumps, web server access logs, database caches, lock files, process ID (PID) files, Linux's scheduled tasks called crontabs, and others.

System logs contain sensitive data, as they provide a detailed insight into the system. So you may find that many directories in /var are protected such that only the user syslog or root has access to read or write. For those that you can see, they'll typically have a format similar to the following:


  • Dec 14 17:00:00 server1 newsyslog[62807]: logfile turned over due to size>100K

Specifically we see: a timestamp (which often does not include the year), the hostname, the service the message is for (with the PID in brackets), and the message itself. If you ever find yourself building or supporting Linux servers, you'll be looking at these files quite a bit, probably about as often as you check out your Event Log in Windows.
That's it for dmesg and system logs. Since we're on the subject of boot messages, next time I'll cover the init command, which boots the system.

TrackBack

TrackBack URL for this entry:
http://www.realtime-windowsserver.com/type/mt-tb.cgi/1039

Post a comment

(All comments are approved by site leader before appearing here. Thanks for commenting!)

line

Greg Shields' Bio:

Greg Shields, is an independent author, instructor, and IT consultant based in Denver, Colorado, and a co-founder of Concentrated Technology. With nearly 15 years of experience in information technology, Greg has developed extensive experience in systems administration, engineering, and architecture specializing in Microsoft systems management, remote application, and virtualization technologies. Greg is a Contributing Editor for Redmond Magazine, MCPmag.com, and Virtualization Review Magazine and is the author of five books, including Windows Server 2008:  What’s New / What’s Changed. Greg is also a highly sought-after instructor and speaker, speaking regularly at conferences like TechMentor Events, and producing computer-based training curriculum for CBT Nuggets.  Greg is a recipient of Microsoft "Most Valuable Professional" award with a specialization in Windows Terminal Services.