Apache下error.log文件太大的处理

偶尔发现Apache下的错误日志非常的大,有4G多,先停止Apache服务的所有进程,最简单就是输命令:net stop apache2.2,然后删除 Apache2/logs/目录下的 error.logaccess.log文件,一下子硬盘可用量大了很多啊!!

 

 想无后顾之忧就限制一下:

打开 Apache 的 httpd.conf配置文件并找到下面两条配置

ErrorLog logs/error.log
CustomLog logs/access.log common

直接注释掉(加#),换成下面的配置文件。


# 限制错误日志文件为 1M
ErrorLog “|bin/rotatelogs.exe -l logs/error-%Y-%m-%d.log 1M”

# 每天生成一个错误日志文件
#ErrorLog “|bin/rotatelogs.exe -l logs/error-%Y-%m-%d.log 86400″

# 限制访问日志文件为 1M
CustomLog “|bin/rotatelogs.exe -l logs/access-%Y-%m-%d.log 1M” common

# 每天生成一个访问日志文件
#CustomLog “|bin/rotatelogs.exe -l logs/access-%Y-%m-%d.log 86400″ common

原文地址:https://www.cnblogs.com/tinyphp/p/3228409.html