Oracle/DB2/Postgresql/Mysql/Hadoop/Greenplum/Postgres-xl/Mongodb
分类: 系统运维
2013-08-06 07:51:33
摘要:
在访问量很大的网站,apache的日志记录access_log文件会比较大.Mod-log-rotate模块可以将日志按照指定的时间间隔分割,减小单个日志文件的空间,便于数据分析.目前版本是1.0,支持主流平台上的Apache1.3 /2.x/2.2.x
Apache-modules Introduction Part 1
Mod-log-rotate
If you host a lot of virtual servers on a single Apache box and use the
supplied rotatelogs program to rotate the logs you'll notice that
your process table is cluttered up with an instance of rotatelogs for each
virtual server. With mod_log_rotate the log rotation is handled
by the server process so you save a bunch of processes and file descriptors.
# Linux env Install:
Install mod_log_rotate using apxs as follows:
apxs -i -a -c mod_log_rotate.c
# Windows env Install:
- Copy mod_log_rotate.so to your Apache2/modules folder
- Install the Visual C++ 2005 SP1 Redistributable Package (the binary is
build with VC 2005 SP1)
# Add to your httpd.conf
LoadModule log_rotate_module modules/mod_log_rotate.so
CustomLog logs/access_log.%Y%m%d-%H%M%S common
RotateLogs On|Off
Enable / disable automatic log rotation.
RotateLogsLocalTime On|Off
Normally the log rotation interval is based on UTC.
For example an interval of 86400 (one day) will cause the logs to rotate at
UTC 00:00.
RotateInterval
Set the interval in seconds for log rotation.
The default is 86400 (one day). The shortest interval that can be specified
is 60 seconds.
An optional second argument specifies an offset in minutes which is applied
to UTC (or local time if RotateLogsLocalTime is on). For example RotateInterval
86400 60 will cause logs to be rotated at 23:00 UTC.