O'Reilly logo

Open Source Web Development with LAMP: Using Linux, Apache, MySQL, Perl, and PHP by Brent Ware, James Lee

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3.6. Apache Log Files

Apache keeps detailed logs of accesses to your web site, errors, and more. The Apache logs are located at /var/log/httpd/access_log and /var/log/httpd/error_log. These locations are configurable in httpd.conf.

It’s a good idea to have a log monitor program running, such as swatch or logwatch, to keep an eye on these files for security violations and problems (see www.logwatch.org). It’s also a good idea to rotate them regularly via logrotate, because they’ll get big otherwise.

Of course, the most important use of the logs is to look at them when there is a problem to figure out what went wrong.

An access_log entry might look like this:

 192.168.1.12 - - [21/May/2001:14:10:05 -0600] "GET / HTTP/1.0" 200 43 "http://www.onsight.com/" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required