Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

How to tell Apache to log each request (visit)?? I'm looking for a bug in my code, and I have to track visitor.

share|improve this question

closed as not a real question by Michael Hampton, rnxrx, Ladadadada, HopelessN00b, Shane Madden Oct 21 '12 at 6:50

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

It already does, by default. – jscott Oct 21 '12 at 3:10
up vote 1 down vote accepted

Out of the box, Apache does log quite a bit into /var/log/apache2, and also records every http request. If you have code going wrong, the tasty details may be in the error log hosted in that directory.

share|improve this answer
This post was tagged centos and in CentOS the logs are in /var/log/httpd by default. – Michael Hampton Oct 21 '12 at 2:39
@MichaelHampton I spend time bipping between several distros, so not surprised I got it wrong. – sysadmin1138 Oct 21 '12 at 2:40
@sysadmin1138 - To be fair, he tagged it with both CentOS AND Apache. =) – David W Oct 21 '12 at 2:41

Your question is fairly basic and also fairly vague, but I'm going to go ahead and take a stab at answering it anyway.

The short answer is yes, Apache can (but doesn't always) log requests. Apache can log several things. Normally error logs and access logs are logged to separate files. On one of my CentOS servers, I log errors to /var/log/httpd/error_log (and sometimes individual vhosts' error logs are logged to yet a different file location).

Access logs and Error logs are defined typically in /etc/httpd/conf/httpd.conf (CentOS / Red Hat) and /etc/apache2/apache2.conf.

However, vhosts will sometimes be configured to log errors and/or access logs to override the default setting.

Good luck.

share|improve this answer

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