Use cronolog for log Conversion

Source: Internet
Author: User
Use cronolog for log conversion ..www.cronolog.org to obtain a new cronolog compilation. Install CustomLogusrlocalapache1.3logsaccess _ logcommon and change it to CustomLog | pai_log _ % wcommon

Use cronolog for log conversion .. http://www.cronolog.org/get new cronolog compilation. install and change CustomLog/usr/local/apache1.3/logs/access_log common to CustomLog "|/usr/local/sbin/cronolog/usr/local/apache1.3/logs/access_log _ % w" common puts ErrorLog/

ExploitationCronolog Conversion..

Http://www.cronolog.org/

Get new cronolog

Compile. Install

Set CustomLog/usr/local/apache1.3/logs/access_log common

Change

CustomLog "|/usr/local/sbin/cronolog/usr/local/apache1.3/logs/access_log _ % w" common

Set ErrorLog/usr/local/apache1.3/logs/error_log

Change

ErrorLog "|/usr/local/sbin/cronolog/usr/local/apache1.3/logs/error_log _ % w"

Note: % w indicates the week of the year. For more information, see man cronolog. A new log is generated every week ..

Then run apache again. Use the graceful parameter:

/Usr/local/apache/bin/apachectl graceful

Use vi to edit a simple script

#! /Bin/bash

Find/usr/local/apache/logs/access *-mtime + 31-exec rm-f {}\;

Find/usr/local/apache/logs/error *-mtime + 31-exec rm-f {}\;

/Usr/local/apache/bin/apachectl graceful

This script allows the system to automatically delete files modified a month ago.

Then vi/etc/crontab

Add a row

* 3 ** 6 root/usr/local/apache/htdocs/ww/baksh/lograte. sh

This indicates that the edited script runs at every week.

Appendix: Meaning of five * in crontab ....

Minute

(0-59)

Hour

(0-23)

Date

(1-31)

Month

(1-12)

Bytes

(0-6)

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.