当前位置: 移动技术网 > 网络运营>服务器>Linux > Apache下error.log文件太大的处理方法

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

2019年05月03日  | 移动技术网网络运营  | 我要评论
清除error.log、access.log并限制apache日志文件大小的方法
有个客户反映vps网站打不开,登录系统检查下,客户是win2003系统,发现放置网站文件的d盘已被占满,可用空间为0kb,进去发现客户apache服务器的错误日志error.log非常的大,造成d盘被爆满。

在网上搜了下相应的资料,并按照如下步骤做了一遍,网站恢复正常

第一步:停止apache服务的所有进程,删除 apache2/logs/目录下的 error.log、access.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

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网