#不记录图片,js,css访问日志
<FilesMatch "\.(ico|gif|jpg|png|swf|js|mp3|css)">
SetEnv NOFILES 1
</FilesMatch>
#去掉日志中的Apache internal dummy connection
SetEnvIf Remote_Addr "::1" NOFILES
CustomLog logs/access_log combined env=!NOFILES
<FilesMatch "\.(ico|gif|jpg|png|bmp|swf)">
SetEnv IMAG 1
</FilesMatch>
CustomLog logs/access_log combined env=!IMAG
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$
{
expires 1d;
access_log off;
}
access_log /www/logs/.log access;
apache下两种方式:
1.只记录html,htm,php等文件
CustomLog logs/-access_log combined env=htm
2.排除法:
SetEnv IMAGE 1
</FilesMatch>
CustomLog logs/-access_log combined env=!IMAGE