If a site's traffic is particularly large, then the access log will be many, but there are some access logs we can actually ignore, such as some of the site's pictures, as well as js,css and other static objects. Access to these files is often huge, and logging of these logs is useless, so you can ignore the logs of those visits.
The related configuration is to include the following statement in the virtual host configuration file:
[[email protected] ~]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf 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 " |/usr/local/apache2/bin/rotatelogs -l /usr/local/apache2/logs/123.com-error_%y%m%d_log 86400 " CustomLog " |/ usr/local/apache2/bin/rotatelogs -l /usr/local/apache2/logs/123.com-access_%y%m%d_log 86400 " combined env=!image-request
Note: In the original log configuration, based on the addition of some image-request definition, such as GIF, JPG, BMP, SWF, JS, CSS, such as the end of the full mark as Image-request, and then in the configuration of the log when adding a tag env=! Image-request, there is an exclamation point, which means that the access log is only logged at the end of these characters, with an inverted, non-additive representation.
Restart Apache, browser detection log file, there is no access record of the above file type.
[Email protected] ~]#/usr/local/apache2/bin/apachectl-tsyntax ok[[email protected] ~]#/usr/local/apache2/bin/ Apachectl restart
This article is from the "Learn Notes for students" blog, please make sure to keep this source http://sanyisheng.blog.51cto.com/11154168/1795816
Lamp--apache log for the specified file type is not logged