Making logrotate and Webalizer play nice

Tags: howtos, linux, software

Published on
« Previous post: Visualizing a security disaster, part I — Next post: Crypto smells »

I am using Webalizer for accessing the logs of all virtual hosts on morrigan. Some time ago, I noticed that the logs were not being analysed completely. Instead, logrotate would cause the current log to be rotated away before Webalizer was able to record any changes.

The solution turned out to be very simple: Instruct Webalizer to use the old log file and enable its incremental mode. Thus, here is my updated configuration file (in excerpts):

LogFile      /var/www/bastian.rieck.ru/logs/access.log.1
OutputDir    /var/www/bastian.rieck.ru/stats
HostName     bastian.rieck.ru
Incremental yes

All configuration files are placed in /etc/webalizer, making it possible to create a cronjob that executes for i in /etc/webalizer/*.conf; do webalizer -c $i; done.