Linux maintains several system logs that help you administer a Linux system by informing you of important events. Probably the most important log is the file /var/log/messages, which records a variety of events, including system error messages, system startups, and system shutdowns. Like most other Linux files, the file contains ASCII text, so you can view it with a text editor or the text processing commands described in Chapter 13.
A special command, dmesg, makes it easy to view the log messages related to the most recent system startup. If your system is behaving unusually, use dmesg to quickly see if something went wrong during the system startup sequence. Of course, you must have some way of determining what's usual and unusual among the many messages emitted during system startup. The best way to do so is to print the output of the dmesg command and keep it on hand for comparison with suspicious output. If your system has an attached printer, you can print the output of dmesg by entering the following command:
dmesg | lpr
Other logs found in the /var/log directory include:
- apache
-
A directory that contains two log files pertaining to the Apache web server, access.log and error.log.
- exim
-
A directory that contains several log files pertaining to the exim mail transfer agent.
- nmb and smb
-
Files that contain log entries pertaining to Samba, the Microsoft-compatible networking server.
- ppp.log
-
A file the contains log entries pertaining to PPP.