Forum Moderators: phranque

Message Too Old, No Replies

Not Log Images / CSS

         

Frank_Rizzo

4:20 pm on Apr 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm trying to not log images to the log file. Here's the code:


<VirtualHost 111.111.111.111>
ServerAdmin webmaster@widgets.com
ServerName widgets.com
ServerAlias www.widgets.com
DocumentRoot /home/sites/widgets
ErrorLog /logs/widgets_error_log
SetEnvIf Request_URI \.gif image-request
CustomLog /logs/widgets_log "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T %v \"%{x-forwarded-for}i\" \"%{CLIENT-IP}i\" env=!image-request
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
</VirtualHost>

That's not working. If I access a page with an image I get this logged:

123.123.123.123 - - [24/Apr/2007:17:15:58 +0100] "GET /images/logo.gif HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8) Gecko/20070309 Firefox/1.5" 0 widgets.com "-" "-" env=!image-request

It looks as if env=!image-request is part of the custom log in that it is stamped in the log rather than apache actioning on the switch.

Is this because mod_setenv is not functioning? It is loaded in the conf file.

----

As a side note. I think it is a good idea not to log images to save on logfile size. But how about taking this further and not logging .css file accesses? What's the point in logging that?

I guess the best option is for apache to only log

.html
.php

as these are pages and not component parts of pages and as logging / tracking is about seeing what pages a user requests there is no point in logging the minor details.

[edited by: Frank_Rizzo at 4:24 pm (utc) on April 24, 2007]

Frank_Rizzo

4:51 pm on Apr 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Doh.

I was missing a closing " on the CustomLog line.

%{CLIENT-IP}i\""