Apache uses log segmentation module Rotatelogs split Log

Source: Internet
Author: User
Tags local time time interval

Rotatelogs is the pipe logger that came with Apache 2.2.

Grammar

Copy code code as follows:
Rotatelogs [-l] logfile [rotationtime [offset]] | [Filesizem]

Options
-L
Use local time instead of GMT time as a time benchmark. Note: using-l in an environment that changes the GMT offset (such as daylight saving time) can lead to unpredictable results.

LogFile
It plus the reference name is the log file name. If logfile contains "%", it is treated as a format string for strftime (), otherwise it is automatically appended with the ". nnnnnnnnnn" suffix in seconds. Both of these formats indicate when the new log is to be used.

Rotationtime
The time interval in seconds that the log file scrolls.

Offset
The number of minutes of time difference relative to UTC. If omitted, it is assumed to be "0″ and use UTC time." For example, to specify local time for a region that has a UTC difference of "-5 hours", this argument should be " -300″."

Filesizem
Specifies to scroll in filesizem file size, rather than by time or slack.

How to use in the master configuration file
Copy code code as follows:
ErrorLog "|bin/rotatelogs-l logs/error_%y%m%d.log 86400"
Customlog "|bin/rotatelogs-l logs/access_%y%m%d.log 86400" combined
[Code]

How to use in a virtual host configuration file
[Code]
ServerAdmin Webmaster@localhost
DocumentRoot "E:/htdocs"
ServerName localhost
ErrorLog "|bin/rotatelogs-l logs/localhost/error_%y%m%d.log 86400"
Customlog "|bin/rotatelogs-l logs/localhost/access_%y%m%d.log 86400" combined

Here is a day a log file, restart Apache buttoned! Above the rotatelogs for your Apache path

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.