Linux system logs are not automatically split

Source: Internet
Author: User
Article Title: linux system logs are not automatically split. 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.

Logs under/var/log are split into logs every seven days. The original logs are named xxx.1 and are automatically deleted after one month. However, some servers do not split logs.

Solution

Log splitting is completed by/etc/cron. daily/logrotate. The configuration file is:

/Etc/logrotate. conf

The content is as follows:

-----------------?

# See "man logrotate" for details

# Rotate log files weekly

Weekly

# Keep 4 weeks worth of backlogs

Rotate 4

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

Create

# Uncomment this if you want your log files compressed

# Compress

# RPM packages drop log rotation information into this directory

Include/etc/logrotate. d

# No packages own wtmp-we'll rotate them here

/Var/log/wtmp {

Monthly

Create 0664 root utmp

Rotate 1

}

# System-specific logs may be also be configured here.

-----------------?

This file specifies parameters such as the split cycle. The specific splitting of each log is completed by the script in the/etc/logrotate. d directory. This directory contains log files of several services, such as apache, mysql, and resin. (The/var/log/maillog of the email is written to the system using syslog)

Run/etc/cron. daily/logrotate manually to see what errors are reported.

Example: report

Error: httpd: 1 duplicate log entry for/var/log/httpd/access_log

This is because duplicate projects exist in the/etc/logrotate. d directory. After checking that the user has installed httpd rpm on his own, there are two directory segmentation projects apache and httpd under the etc/logrotate. d directory, which causes logrotate to fail to run.

Solution: remove the/etc/logrotate. d/httpd file. We recommend that you check for redundant log splitting items based on a clean server.

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: info-contact@alibabacloud.com 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.