Apache Log Cutting

Source: Internet
Author: User
Tags apache log

Apache is still relatively cool, with its own Rotatelog program, edit the Apache master configuration file, the following changes:

Comment out the following two lines

Errorlog Logs/error_log

Customlog Logs/access_log Common

Then add the following two lines
Errorlog "|bin/rotatelogs logs/errorlog.%y-%m-%d-%h_%m_%s 2M +480″

Customlog "|bin/rotatelogs logs/accesslog.%y-%m-%d-%h_%m_%s 2M +480″common

The meanings are as follows:

errorlog.%y-%m-%d-%h_%m_%s is the format of the generated log, similar to the following: Errorlog.2010-04-15-11_32_30, in days and minutes and seconds,

2M is the size of the log, that is, when the log reaches a new log file, the supported units are K,M,G, the department is 2M

+480 is the time difference, the file is in the United States time, China's jet lag is 8 hours more than the United States is 480 minutes, so add 480 minutes

There are other ways to set this up:

Generate an error log file every day

Errorlog "|bin/rotatelogs.exe-l Logs/error-%y-%m-%d.log 86400″

Where 86400 is the time unit of rotation in seconds

This article is from the "Target: India" blog, please be sure to keep this source http://shunzi115.blog.51cto.com/5184443/1825941

Apache Log Cutting

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.