Logs and Monitoring for Apache Servers
[next]
Logs and Monitoring for Apache Servers
Introduction to Logging in Apache
In addition to the error logging functionality described in the previous chapter, Apache provides extensive facilities for recording information about every aspect of a request. This chapter covers the most common issues found when logging requests, such as conditional logging, log rotation, resolution of IP addresses, and piped logging. It also covers a number of bundled and third-party modules and utilities for monitoring the status of your Apache server and to analyze its logs.
Default Apache Log Files
Apache provides a number of monitoring and logging facilities to track the correct operation of the server. The default Apache configuration provides two log files, placed inside the logs directory of the installation directory:
|
Creating Log Formats
The LogFormat
directive allows you to tell Apache which aspects of the request you want to record. You will still need additional directives to tell Apache where to log that information, but that is addressed in the next section. This example shows the configuration for the two most popular formats, the Common Log Format and the Combined Log Format. When Apache receives a request, it will substitute each one of the fields prefixed by a % with the corresponding request attribute. If you are using the CLF, each entry in your log file will look like this:
If you are using the combined common format, each entry in your log file will look like this:
Although the appendix provides a comprehensive logging format reference, this list describes the most important fields:
|
The combined log format extends the common log format with two additional fields. It is defined as
|
[next]
URL: