Svn – How to disable Apache log just for SVN

apache-2.2loggingmod-dav-svnsvn

I have an Apache running as HTTP server and also a SVN server which is delivered by the same Apache machine.

Configured with something like

<Location /repos>
      DAV svn
      SVNParentPath /srv/repos
</Location>

How can I prevent Apache to log all the SVN "PROPFIND" and "OPTIONS" access requests?

Best Answer

I thought there wasn't a way to do this, but turns out there might be. The CustomLog directive can look for the existence of an environment variable to decide to log the request or not. Combine that with mod_rewrite to set that environment variable, and I think you have what you're looking for.

RewriteEngine On
RewriteCond %{REQUEST_METHOD} '^(OPTIONS|PROPFIND)$'
RewriteRule ^/repos - [E=skiplog:1]
CustomLog /log/file/path common env=!skiplog

I haven't tested this. From what I'm reading in the docs though, this should work.

Related Topic