Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2737025
  • 博文数量: 423
  • 博客积分: 7770
  • 博客等级: 少将
  • 技术积分: 4766
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-09 11:58
个人简介

Oracle/DB2/Postgresql/Mysql/Hadoop/Greenplum/Postgres-xl/Mongodb

文章分类

全部博文(423)

文章存档

2019年(3)

2018年(6)

2017年(27)

2016年(23)

2015年(30)

2014年(16)

2013年(31)

2012年(73)

2011年(45)

2010年(14)

2009年(30)

2008年(30)

2007年(63)

2006年(32)

分类: 系统运维

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.

阅读(3354) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~