Article Title: System Administrator Toolkit: Basic knowledge of log files. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
In typical UNIX? Or Linux? Many log files are created during computer operations. Some of these log files contain useful information, and some help you plan your capacity and resources. This article focuses on the basic information recorded in different log files, their locations, and how to use this information to determine the running status of the system.
About this series
A typical UNIX Administrator has a set of key utilities, tricks, and systems that are often used to assist in management processes. Some important utilities, command lines, and scripts can be used to simplify various processing processes. Some of these tools come from the operating system, while most of them come from long-term experience accumulation and the requirement to reduce the work pressure of the system administrator. This series of articles focuses on maximizing the use of tools available in a variety of UNIX environments, including methods to simplify management tasks in heterogeneous environments.
Log Files
All systems generate different numbers of log files used to track and record different information about computers. The content and utility of these files vary from system to system, but the core information provided by the files is usually consistent.
For example, all UNIX and Linux computers use syslog (a general logging system used by the operating system, applications, and services to record information) to record information. Syslog records a large amount of data, including logon, performance information, and faults reported by different hardware and systems. In addition to syslog, the system also provides various service, environment, and application logs used to record information about computers and their operations.
Although analyzing and extracting the information of log files can be time-consuming and complex, the value of the information in these logs cannot be ignored. Log files can provide prompts about potential problems, errors, and security vulnerabilities. If used correctly, you can even provide warnings about server load and capacity.
Log location
The location of various log files varies by system. In most UNIX and Linux systems, most log files are stored in/var/log. For example, listing 1 shows a list of log files on Gentoo Linux.
Listing 1. Linux/var/log directory content
$ Ll/var/log
Total 3312
-Rw-r ----- 1 root 8218 dmesg
-Rw ---- 1 portage 650111 emerge. log
-Rw ------- 1 root 24024 faillog
-Rw-r -- 1 root 386032 genkernel. log
Drwxr-xr-x 2 root 4096 iptraf/
-Rw-r -- 1 root 292292 2008-02-03 08:07 lastlog
-Rw ------- 1 root 1346931 2008-02-03 08:50 messages
Drwxr-xr-x 2 root 4096 news/
Drwxr-xr-x 3 root 4096 portage/
Drwxrwx --- 2 root portage 4096 sandbox/
Drwxrwx --- 2 snort 4096 snort/
-Rw-r -- 1 root utmp 496896 2008-02-03 wtmp
-Rw-1 root mc 61189 Xorg.0.log
-Rw-1 root 61189 Xorg.0.log. old
|
In Solaris? IBM? AIX? HP-UX? The main syslog and most other log files are written to files in the/var/adm directory (List 2 ).
Listing 2. Traditional UNIX/var/adm content
$ Ls-al/var/adm
Total 230
Drwxrwxr-x 9 root sys 512 Feb 3.
Drwxr-xr-x 48 root sys 1024 Feb 3 ..
Drwxrwxr-x 5 adm 512 Feb 2 acct
-Rw ------- 1 uucp bin 0 Jan 12 18:49 aculog
Drwxr-xr-x 2 adm 512 Feb 2 exacct
-R -- 1 root 2856 Feb 3 16:10 lastlog
Drwxr-xr-x 2 adm 512 Feb 2 log
-Rw-r -- 1 root 69065 Feb 3 16:08 messages
Drwxr-xr-x 2 root sys 512 Feb 2 pool
Drwxrwxr-x 2 adm sys 512 Feb 2 sa
Drwxr-xr-x 2 root sys 512 Feb 2 sm. bin
-Rw-1 root bin 0 Jan 12 :47 spellhist
Drwxr-xr-x 2 root sys 512 Feb 2 streams
-Rw ------- 1 root 93 Feb 3 16:08 sulog
-Rw-r -- 1 root bin 3720 Feb 3 utmpx
-Rw-r -- 1 adm 29760 Feb 3 wtmpx
|
In addition, some non-system-level messages and information are written into logs in/var/log (listing 3 ). For example, on Solaris, the mail debugging item writes/var/log/syslog by default.
Listing 3. Other logs in/var/log on Solaris
$ Ls-al/var/log/
Total 48158
Drwxr-xr-x 7 root sys 512 Feb 3.
Drwxr-xr-x 48 root sys 1024 Feb 3 ..
-Rw ------- 1 root sys 0 Jan 12 18:48 authlog
-Rw-r -- 1 root other 27 Feb 2 16:17 brlog
Drwxr-xr-x 2 root 512 Feb 2 women's disease
Drwxr-xr-x 2 root sys 512 Feb 2 pool
-Rw-r -- 1 root sys 24480410 Feb 3 postrun. log
Drwxr-xr-x 2 root sys 512 Feb 2 swupas
-Rw-r -- 1 root other 635 Feb 2 sysidconfig. log
-Rw-r -- 1 root sys 3967 Feb 3 syslog
Drwxr-xr-x 3 root sys 512 Feb 2 webconsole
Drwxr-xr-x 2 root sys 512 Feb 2 xen
-Rw-r -- 1 root 66171 Feb 3 16:07 Xorg.0.log
-Rw-r -- 1 root 66256 Feb 3 16:06 Xorg.0.log. old
|
Of course, finding a file is the minimum problem. You need to know the useful information contained in the file.
According to UNIX variants, some logs may be messy elsewhere. However, some meaningful attempts have been made to standardize the file location, so that all log files are classified into one of the directories mentioned above.
[1] [2] [3] [4] Next page