码迷,mamicode.com
首页 > Web开发 > 详细

LAMP 2.1Apache不记录指定文件类型日志

时间:2015-12-08 23:54:28      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:

访问日志只需要记地址,不用记录图片。

对无用的图片日志做标记,针对标记做限制。打开

vim /usr/local/apache2/conf/extra/httpd-vhosts.conf

 

   ErrorLog "logs/denny.com-error_log"
   CustomLog "|/usr/local/apache2/bin/rotatelogs -l  /usr/local/apache2/logs/denny.com-access_%Y%m%d_log 86400" combined

改成

   SetEnvIf Request_URI ".*\.gif$" image-request
   SetEnvIf Request_URI ".*\.jpg$" image-request
   SetEnvIf Request_URI ".*\.png$" image-request   SetEnvIf Request_URI ".*\.bmp$" image-request   SetEnvIf Request_URI ".*\.swf$" image-request
   SetEnvIf Request_URI ".*\.js$" image-request
   SetEnvIf Request_URI ".*\.css$" image-request
   ErrorLog "logs/denny.com-error_log"
   CustomLog "|/usr/local/apache2/bin/rotatelogs -l  /usr/local/apache2/logs/denny.com-access_%Y%m%d_log 86400" combined env=!image-request

 

查看文件是否正确,重启。

apachectl -t
/usr/local/apache2/bin/apachectl restart

 

查看日志

less /usr/local/apache2/logs/denny.com-access_20151209_log 

 

查看文件是否正确

LAMP 2.1Apache不记录指定文件类型日志

标签:

原文地址:http://www.cnblogs.com/wangshaojun/p/5031167.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!