4

Got a weird issue with the apache access logs. I am getting an entry for the site written to

/var/log/apache2/access.log

AND

/var/log/apache2/other_vhosts/access.log

I am using Debian 6, with the latest Apache in the repo. When I look at the file

/etc/apache2/conf.d/other-vhosts-access-log

It says

# Define an access log for VirtualHosts that don't define their own logfile
CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined

but when I look in my VirtualHost declaration for the site, it has

    CustomLog ${APACHE_LOG_DIR}/access.log vhost_combined
</VirtualHost>

at the bottom of the file. So I have declared the log file, so why does apache still write an entry to the other_vhosts_access.log?

In the end, I commented out the line in the apache/conf.d file, but doesn't feel like it's the best way.

What am I missing?

2

Without seeing the full apache configuration this is difficult to diagnose but some things to look at

  • Check that you're not including or defining a second log file within the same vhost - this will cause double logging.
  • Check that the log files aren't linked to each other - find /var/log/apache2 -samefile /var/log/apache2/access.log will list them both if this is true.

Consider the possibility that this is a bug.

-1

Try with

CustomLog ${APACHE_LOG_DIR}/access.log combined

  • 2
    That's not an answer to the question. – Jenny D Mar 11 '13 at 10:19
  • Your comment is not a downvote to the non-answer to the question – alexg Feb 29 '16 at 13:09
  • I don't see how changing the logging format for a less precise one can make a difference. Apache docs clearly specify If CustomLog or ErrorLog directives are placed inside a <VirtualHost> section, all requests or errors for that virtual host will be logged only to the specified file. Any virtual host which does not have logging directives will still have its requests sent to the main server logs. – Law29 Jun 30 '16 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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