清除Apache日志文件

时间:2022-02-22 19:53:46

Apache下的apache_access.log和error.log文件一直没动,发现已经3G左右了。

windows下删除apache_access.log和error.log文件

1. 删除C:\wamp\logs目录下的apache_access.log和access.log文件

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

ErrorLog "c:/wamp/logs/apache_error.log"
CustomLog "c:/wamp/logs/access.log" common


修改为

#ErrorLog "c:/wamp/logs/apache_error.log"
#限制错误日志文件为 1MErrorLog "|bin/rotatelogs.exe -l c:/wamp/logs/apache_error-%Y-%m-%d.log 1M"
#每天生成一个错误日志文件ErrorLog "|bin/rotatelogs.exe -l c:/wamp/logs/apache_error-%Y-%m-%d.log 86400"


#CustomLog "c:/wamp/logs/access.log" common
CustomLog "|bin/rotatelogs.exe -l c:/wamp/logs/access-%Y-%m-%d.log 1M" common
CustomLog "|bin/rotatelogs.exe -l c:/wamp/logs/access-%Y-%m-%d.log 86400" common

清除Apache日志文件