Some explanations of Linux system logs

Source: Internet
Author: User
Tags dmesg

Linux system logs

content in the file ( Dump = = Archive)

# see ' Man logrotate ' for details

# Rotate log Files Weekly

Weekly//= Cut once a week

# Keep 4 weeks worth of backlogs

Rotate 4//After cutting, we retain up to 4 files (under/var/log/)

# Create new (empty) log files after rotating old ones

Create//Generate a new log file (it is created when the file is not stored after dumping)

# Use date as a suffix of the rotated file

Dateext//reserved Four files, suffixes are named in the format of a date

# Uncomment this if you want your log files compressed

#compress//Compressed log file, commented out means not compressed

# RPM Packages Drop log rotation information into this directory

INCLUDE/ETC/LOGROTATE.D //In our/ETC/LOGROTATE.D directory there are many such configuration files (other log dumps, included in this directory)

# no packages own wtmp and btmp--we ' ll rotate them here

/var/log/wtmp {//dump configuration about WTMP

Monthly//Monthly archive

Create 0664 root utmp//0664 for permissions, Root is owner, group is utmp

MinSize 1M//The smallest size is 1 trillion, if less than 1 trillion, we do not cut

Rotate 1//reserved only one, backup


/var/log/btmp {



Create 0600 Root utmp

Rotate 1


# system-specific logs May is also is configured here.

Content in the file







sharedscripts//This means that we can use some of the commands in this cutting configuration file .

Postrotate//Indicates some of the operations performed after the cut is completed

/bin/kill-hup ' cat/var/run/ 2>/dev/null ' 2>/dev/null | | true

The command means: Regenerate a new log



3. The most important log files to view

/var/log/messages (can be viewed with cat commands)

/var/log/wtmp (cannot be viewed directly with the cat command, using the Last view, actually the last call of the file is the/var/log/wtmp file)

/var/log/btmp (similar to wtmp, except that it looks at invalid login history and is viewed with lastb )


/var/log/secure//Normal or failed login it is recorded in the log file

/VAR/LOG/DMESG//This log saves some hardware-related logs (for example: disk, NIC, USB) during the boot process of our system

We also have an order DMESG, this command check to see the/VAR/LOG/DMESG file is not necessarily the same, DMESG to see the real-time log, and the/var/log file is our system startup process recorded in some of the logs, they are not the same

DMESG: helps us to get information about hardware errors (if your network card fails, or if your disk is read-only, you can use DMESG to view and get useful information

Extension questions:

The syntax for the Logger command is:

Logger [-i] [-f filename] [-p priority] [-t tag] [message ...]

Options Description

-f filename takes the contents of the filename file as a log

-I each row records the ID of the logger process  

-P priority specifies precedence, priority must be shaped like facility.priority a complete selector with the default priority of User.notice.

-T tag marks each record line with the specified label.

Message the log content to write, with multiple logs separated by spaces, such as

The log content is not specified, and the-f filename option is

NULL, then the standard input is used as the log content.

Ping | Logger-it jin-p Local3.notice &

(Default write in/var/log/messages file, CentOS 6.8 version)

What you want to see is this: Tail-f/var/log/messages

This article from the "11842333" blog, reproduced please contact the author!

Some explanations of Linux system logs

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.