Apache HTTP Server Log

The Apache HTTP Server provides a detailed and flexible information-logging mechanism. The two most important log files are the error and access logs. The default location for the Apache HTTP Server log files is the following directory: /var/log/apache2

Using the Error Log to Diagnose the Apache HTTP Server

The Apache HTTP Server records diagnostic information and all errors encountered while processing requests to the error log file, error_log.

For example, if you visit a nonexistent URL, the following 404 error is generated:

The requested URL /non-exist/ was not found on this server.

All error information is recorded in the default error log file, which you can obtain by entering the following command:

#tail –f /var/log/apache2/error_log

The following message is added to the end of the file:

[Sat Feb 03 13:03:55 2007] [error] [client 10.100.0.86] File does not exist: /srv/www/htdocs/non-exist

Using Webalizer to Perform Apache HTTP Server Log Analysis

Webalizer is an analysis tool that you can use to generate detailed usage reports using the information recorded in the Apache HTTP Server logs. Webalizer provides easy-to-read reports in HTML format that you can customize for your needs.

Use the following procedure to set up Webalizer:

1.Modify the Webalizer configuration file, /etc/webalizer.conf, by adding the following lines:

LogFile /var/log/apache2/access_log

OutputDir /srv/www/htdocs/webalizer

2.Restart the Apache server by entering the following:

#/etc/init.d/apache2 restart

3.Run the Webalizer program to generate a report:

#webalizer

A message similar to the following appears:

Webalizer V2.01-10 (Linux 2.6.16.21-0.8-smp) English Using logfile /var/log/apache2/access_log (clf)

DNS Lookup (10): 1 addresses in 1.00 seconds, 1/sec Using DNS cache file dns_cache.db

Creating output in /srv/www/htdocs/webalizer Hostname for reports is 'bl35p-16' Reading history file... webalizer.hist Generating report for February 2007 Generating summary report

Saving history information...

307 records in 1.00 seconds, 307/sec

Verify that the server status configuration is correct by opening a browser and entering the following website:

http://<YOUR_WEB_SERVER_IP>/webalizer

Figure 8 shows an example of a Webalizer usage report web page.

Installing, Configuring, and Managing Web Server Middleware Stack Components 21

Page 21
Image 21
HP 5991-5565 manual Apache Http Server Log, # /etc/init.d/apache2 restart, # webalizer