Chinaunix首页 | 论坛 | 博客
  • 博客访问: 117811
  • 博文数量: 14
  • 博客积分: 558
  • 博客等级: 中士
  • 技术积分: 140
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-22 10:32
文章分类
文章存档

2013年(1)

2011年(1)

2010年(6)

2009年(6)

我的朋友

分类: 系统运维

2010-09-08 10:16:49

默认情况下,apache对web访问的全部请求url均进行记录在access_log日志下,
每个页面包含大量的图片等静态文件,造成access_log文件膨胀速度飞快,对服务器性能有一定的影响,
同时对我们从访问日志进行安全分析等工作也带来不便,因此可以考虑对日志记录进行过滤。
 
编辑httpd.conf文件,加入如下过滤规则:
 
#fileter log: if visit images or static files,don't log
SetEnvIf Request_URI ".jpg$" filenotlog
SetEnvIf Request_URI ".gif$" filenotlog
SetEnvIf Request_URI ".bmp$" filenotlog
SetEnvIf Request_URI ".css$" filenotlog
SetEnvIf Request_URI ".txt$" filenotlog
 
配置加入日志过滤条件:
 
CustomLog "logs/access_log" common env=!filenotlog
 
检查配置文件语法:
[root@weblogic bin]# ./apachectl -t
Syntax OK
重启apache进程:
[root@weblogic bin]# ./apachectl graceful
 
查看日志应该就不会再出现上面不记录的文件类型jpg、bmp、gif、css、txt的记录了
阅读(3451) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-09-10 20:12:28

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com