Split access logs with Apache's own tools

Source: Internet
Author: User

httpd.conf Customlog Logs/access.log Common changed into
Customlog "|c:/apache/bin/rotatelogs.exe c:/apache/logs/access_%y_%m_%d.log 86400" common
Change C: To the path where you installed Apache.
Restart Apache

Where c:/apache/is where you install the Apache path so that each is born into a log file

  • Found in Apache configuration file
    Errorlog Logs/error_log
    Customlog Logs/access_log Common

    Linux System Configuration Method:

    Change it to
    Errorlog "| /usr/local/apache/bin/rotatelogs/home/logs/www/%y_%m_%d_error_log 86400 480 "
    Customlog "| /usr/local/apache/bin/rotatelogs/home/logs/www/%y_%m_%d_access_log 86400 480 "common

    Configuration method under Windows system:

    #ErrorLog "|bin/rotatelogs.exe logs/vicp_net_error-%y%m%d.log 86400 480"
    #CustomLog "|bin/rotatelogs.exe logs/vicp_net_access-%y%m%d.log 86400 480" common

    The first time I do not know the setting of 480 this parameter, resulting in a log record time and server time difference of 8 hours, the original is Rotatelogs has an offset parameter, the number of minutes relative to UTC, China is the eighth time zone, the difference of 480 minutes. 86400 is a 1-day representation.

    Attached rotatelogs Instructions

    Rotatelogs logfile [rotationtime [offset]] | [Filesizem]

    Options
    LogFile
    It adds the base name to the log file name. If the logfile contains '% ', then it is treated as a format string for the strftime (3); otherwise, it is automatically appended with the. nnnnnnnnnn suffix in seconds. Both formats represent the time when the new log began to be used.
    Rotationtime
    The interval of time in seconds for the log file to be rolled back
    Offset
    The number of minutes of the time difference relative to UTC. If omitted, it is assumed to be 0, and UTC time is used. For example, to specify local time for a region with a UTC difference of 5 hours, this parameter should be-300.
    Filesizem
    Specifies the file size of the suffix letter M in megabytes when the volume is returned, instead of specifying the rollback time or the slack.

    ---------------

    httpd.conf Customlog Logs/access.log Common changed into

    Customlog "|c:/apache/bin/rotatelogs.exe c:/apache/logs/access_%y_%m_%d.log 86400" common

    Change C: To the path where you installed Apache.

    Restart Apache

    Where c:/apache/is where you install the Apache path so that each is born into a log file

Split access logs with Apache's own tools

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.