Basj Basj - 1 year ago 63
Apache Configuration Question

Don't log certain requests in Apache access.log

I recently replaced Google Analytics by the self-hosted analytics tool Piwik.

This means that every time someone connects my website, a Javascript tracking code is executed on the client, that calls my Piwik server


  1. on my server's Apache
    , there is a line about, that's normal

  2. in my Piwik database, an information is stored about this visit, this is normal

  3. on my server's Apache
    , there is a line about the fact my Piwik server received a tracking request (executed by client with JS)

The logging part 3. is clearly too much!
From now, since Piwik in installed, my
is double sized!

How to remove the fact that Apache logs in access.log the connection to ? i.e. client JS tracking code <--> Piwik server ?

Answer Source

The solution is to disable logging of certain requests (for example in /etc/apache2/sites-available/000-default.conf with Debian 8):

<VirtualHost *:80>
  DocumentRoot /home/www/mywebsite
  SetEnvIf Request_URI "^/piwik(.*)$" dontlog
  CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined env=!dontlog
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download