`
bd_cool
  • 浏览: 59114 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Apache日志滚动和过滤

阅读更多

终于是可以让Apache不产生超大的日志了。

 

原文

#CustomLog "logs/access.log" combined

 

改为
SetEnvIf Request_URI "\.(js|css|gif|jpg|png|swf|ico)$" dontlog
SetEnvIf Request_URI "\.(html|htm)$" dontlog

    
CustomLog "|bin/rotatelogs.exe logs/access.%Y_%m_%d.log 86400 480" common env=!dontlog

 

其中SetEnvIf 表示是否匹配URI,结果为dontlog,多行按或的关系处理,写日志是env=!dontlog,表示不匹配的才写入日志。

 

86400是一天的秒数,文件滚动周期。

 

480当地时间与标准时的时差分钟数这里取北京时间GMT+8。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics