Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to update my apache logging so that its destination is based on the user agent string or file type.

Specifically, I would like to send my googlebot requests to their own log file, and I would like to not log requests for any of my image files.

My configuration is pretty much stock.

share|improve this question
up vote 4 down vote accepted

Try adding something like the following into your VirtualHost config:

SetEnvIf User-agent .*Googlebot.* googlebot
CustomLog /var/log/apache2/access_googlebot.log combined env=googlebot
CustomLog /var/log/apache2/access.log combined env=!googlebot
share|improve this answer
In reference to the reply by Ewan, When you refer to VirtualHost config would that be the apache2.conf, the httpd.conf, or other file? – user10891 Oct 17 '11 at 6:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.