网站首页 博客 apache日志切割报错failed_unexpectedly
apache日志切割报错failed_unexpectedly
 2021-05-20 11:21:10  管理员  165

apache日志切割报错failed_unexpectedly

apache日志里面频繁报错:

piped log program 'bin/rotatelogs.exe logs/xxx-access_%Y%m%d.log 86400 480' failed unexpectedly


网上解释的原因:

如果是使用大量的虚拟主机,并且使用不同的日志文件的时候,apache可能会用尽操作系统的可用的文件句柄数。


解决方法:

减少vhosts里面的日志文件,集中到主站的日志文件中。

在主站的日志格式中加入请求的域名%v

<IfModule log_config_module>

    LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

    LogFormat "%v %h %l %u %t \"%r\" %>s %b" common


    #CustomLog "logs/access.log" common

CustomLog "|bin/rotatelogs.exe logs/access_%Y%m%d.log 86400 480" common

</IfModule>


来说两句吧
最新评论