Enterprise Software

Tech Tip: Enhance Apache log files

Find out how to enhance Apache log files.

By default, Apache logs a fair amount of information. However, if you plan on performing some statistical analysis on files using tools such as Webalizer or Analog, you may wish to get as much information as possible into your log files to enhance your reports.

You can accomplish this by using the Combined Log Format rather than the default Common Log Format. In your Apache configuration files, search for the CustomLog keyword, and modify it to look like the following:

CustomLog  logs/access_log combined

Using the Combined Log Format produces the same logged information as before, and it also logs the Referrer and User-Agent headers, which indicate where users were before visiting your Web site page and which browsers they used, respectively.

You can get more information from Apache by changing the LogLevel keyword. The default LogLevel setting is warn, which logs warning conditions to the log.

You can reduce what Apache logs by changing the LogLevel to error (error conditions) or crit (critical conditions). You can increase what Apache logs by setting the LogLevel to notice (normal but significant condition) or info (informational). These two options provide a lot more information about what Apache is doing.

The highest log level is debug (debug-level messages), which provides quite a lot of information. Use this level only when debugging problems with the server.

You can change the log level by searching the Apache configuration file (usually httpd.conf) for the LogLevel keyword and changing it. For example:

LogLevel error

Editor's Picks

Free Newsletters, In your Inbox