Previous Section  < Day Day Up >  Next Section

Recipe 22.21. Viewing Apache Access Logs with Webalizer

22.21.1 Problem

Crawling through access_log is somewhat less than fun. It's huge, it's plain text, and your eyes glaze over. Isn't there some kind of nice graphical log viewer and analyzer, with colors and graphs?

22.21.2 Solution

Use Webalizer. Webalizer automatically creates HTML pages of hyperlinked color graphs, generated from your Apache access_log.

Download and install Webalizer in the usual manner; it comes in sources and packages. After installation, test it with this command:

# webalizer /etc/httpd/logs/access_log

Webalizer V2.01-10 (Linux 2.4.21) locale: C

Using logfile /etc/httpd/logs/access_log (clf)

Creating output in /var/www/webalizer

Hostname for reports is 'windbag'

Reading history file... /var/www/webalizer/ webalizer.hist

Reading previous run data... webalizer.current

Saving current run data... [08/08/2004 15:31:06]

Generating report for August 2004

Generating summary report

Saving history information...

107 records (97 ignored) in 0.15 seconds

Now enter /var/www/webalizer/index.html in a web browser, and you will see a page like Figure 22-3.

Figure 22-3. Viewing access_log with Webalizer


This shows only a few days' worth of activity, since this is from a web site created just for illustrating this chapter. As more history accumulates, you'll be able to view graphs of nearly any statistic captured in your log, by months, days, and hours.

Now you should configure /etc/webalizer.conf. Make sure the filepaths are correct for your system:

LogFile             /etc/httpd/logs/access_log

OutputDir           /var/www/webalizer

HistoryName         /var/www/webalizer/webalizer.hist

You may specify only a single log file. Now you can generate an updated Webalizer page simply by typing:

# webalizer

22.21.3 Discussion

The LogFormat directives in httpd.conf control what data is passed to Webalizer:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

CustomLog logs/access_log combined

So if there is some information missing that you want to see, check your LogFormat directives. Webalizer also has some simple log filters for customizing what stats you wish to see; look in /etc/webalizer.conf.

22.21.4 See Also

  • http://localhost/manual/mod/mod_log_config.html

  • webalizer(1)

    Previous Section  < Day Day Up >  Next Section