Apache的log文件长得太快了

王朝厨房·作者佚名  2007-01-05
窄屏简体版  字體: |||超大  

Apache的log文件长得太快了

我的apache服务器的log文件长得很快。

我想定期把一个阶段的log文件,放到另外一个目录里做备份

比如,每星期把log文件的全部内容放到另外一个文件里,让当前的log文件大小为0。每星期如此重复。

该怎么做?

手动怎么做?

有什么自动的办法么?

多谢

deathcult 回复于:2003-09-21 14:45:01

man rotatelogs

lzv 回复于:2003-09-22 10:35:20

http://httpd.apache.org/docs/misc/FAQ.html#rotate

The simple answer: by piping the transfer log into an appropriate log file rotation utility.

The longer answer: In the src/support/ directory, you will find a utility called rotatelogs which can be used like this:

TransferLog "|/path/to/rotatelogs /path/to/logs/access_log 86400"

to enable daily rotation of the log files.

A more sophisticated solution of a logfile rotation utility is available under the name cronolog from Andrew Ford's site at http://www.cronolog.org/. It can automatically create logfile subdirectories based on time and date, and can have a constant symlink point to the rotating logfiles. (As of version 1.6.1, cronolog is available under the Apache License). Use it like this:

CustomLog "|/path/to/cronolog --symlink=/usr/local/apache/logs/access_log /usr/local/apache/logs/%Y/%m/access_log" combined

xiaoxiaoke 回复于:2004-02-15 20:50:23

强烈建议采用cronolog工具,可以针对不同周期来轮循,而且对webaliaze工具也支持得很好

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航