Apache Log Cutting

Source: Internet
Author: User
Tags apache log

# # #apache Log Cut
wget http://cronolog.org/download/cronolog-1.6.2.tar.gz
Tar zxf http://cronolog.org/download/cronolog-1.6.2.tar.gz
CD cronolog-1.6.2
Make && make install

Vi/etc/httpd/conf/httpd.conf
#CustomLog/data/logs/httpd/access_log combined modified to read as follows:
Customlog "|/usr/local/sbin/cronolog/data/logs/httpd/access_log.%y%m%d" combined

Effect:
[Email protected] ~]# ll/data/logs/httpd/access_log.20151023
-rw-r--r--1 root root 1602 Oct 15:06/data/logs/httpd/access_log.20151023

Related concepts:

Escape character
%% character
N Line break
T horizontal tab

Time Domain
H Hours (00..23)
I Hour (01..12)
P The AM or PM ID under this locale
M min (00..59)
s seconds (00..61, which allows for leap seconds)
X the time representation under the locale (e.g.: "15:12:47")
Z time zone. Meaningless if the time zone is not determined

Date field
A the name of the weekday under this locale (e.g.: Sun. Sat)
A full name of the working day under the locale (e.g.: Sunday. Satur-ay)
b the month abbreviation under this locale (e.g.: Jan. DEC)
B the full name of the month under this locale (e.g.: January. December)
C Date and time under this locale (e.g.: "Sun Dec 14:12:47 GMT 1996")
D Number of days in the month (01:31)
J Number of days in the current year (001:366)
M number of months (01:12)
The number of weeks in the current year, beginning with Sunday as a week, with the first week of the week including Sunday (00..53)
W the number of weeks in the current year, with Monday as the beginning of the week, the first week of which included the week of Sunday (00..53)
W working days (0:6, 0 = Sunday)
X the date representation under the locale (e.g. "13/04/97")
Y two-digit year (00:99)
Y Four-digit year (1970:2038)

This article from "Technical Cock silk" blog, declined reprint!

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.