WarpZero RSS WarpZero@Twitter WarpZero@LinkedIn Michael Marth@Facebook Monday, 21-May-2012 01:46:24 EDT
   
warpzero.com

° Home
° News & Updates
° Howto & Knowledge Base
° External Resources
° Contact us
° Search
° Site Validated
° Site Map




Disable logging of gifs/jpgs from webserver




Below shows how to remove gifs/jpgs from being logged by the webserver. This will reduce the log size being stored on the filesystem.

Note: Modify the parameters to suit your environment.


  1. Goto the directory in which your webserver configurations reside. For the purpose of this document, we will assume the webserver is installed within "/usr/local/apache"

    cd /usr/local/apache/conf

  2. Backup the current configurations

    mkdir backup-`date`
    cp * backup-`date`

  3. Modify the httpd.conf by adding the below lines. The below statements instruct the webserver to declare an environment variable "gif-image" that will look at the URI for ".gif" and ".jpg".

    SetEnvIf Request_URI \.gif$ gif-image
    SetEnvIf Request_URI \.jpg$ gif-image

    To remove other images/files from being logged, add another statement as above except change the file extension.

  4. Modify the "CustomLog" parameter or whichever logging statement being used today, to utilize the new logging format.

    • Old Log Format
      CustomLog /logs/https/wzc_www/access combined
    • New Log Format
      CustomLog /logs/https/wzc_www/access combined env=!gif-image

    The "env=!gif-image" appended to the "CustomLog" parameter instructs the webserver not to log any files which defined within the "gif-image" environment variable.

  5. Restart the webserver in order for the new parameters to take effect.

    /usr/local/apache/bin/apachectl restart

  6. Once the webserver has been restarted the webserver logs will no longer have any entries refering to ".gif" and ".jpg".

Linux Counter
Apache
IBM Canada
Cisco Systems
RedHat
Linux
 
 Published: Wednesday, 10-Nov-2010 05:08:20 EST