[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] Webalizer, logrotation etc.



I installed Webalizer two days ago and it works great. But I have done a few
changes:

1. Installed webalizer.pkg

2. Moved webalizer.pl from /etc/cron.daily to /usr/local/bin, renaming it to
webalizer_sites.pl

3. Created created the script /usr/local/bin/webalizer_all.pl:

Webalizer_all.pl is a script which runs webalizer on /var/log/httpd/access for
complete web server statistics. Target is (existing)
/home/sites/home/web/allstats. This report is for the curious server admin ...
;-)

#!/usr/bin/perl
my $messages;
$messages .= `webalizer -n "MyRaq" -q -T -o /home/sites/home/web/allstats
/var/log/httpd/access`;
# Debugging printer, uncomment to use.
#print $messages;
exit 0;

4. Configured Webalizer to work incrementally:

Change "#Incremental no" in /etc/webalizer.conf to "Incremental yes" or insert
the -p flag in both scripts.

5. Added (-->) both scripts in /etc/logrotate.d/apache:

/var/log/httpd/access {
        prerotate
-->                /usr/local/bin/webalizer_all.pl
                /usr/local/sbin/split_logs web < /var/log/httpd/access
-->                /usr/local/bin/webalizer_sites.pl
        endscript
    missingok
    postrotate
        /bin/kill -USR1 `cat /var/run/httpd.pid`
    endscript
    daily
}
...

Therefore the server analyzes the total access log using webalizer_all.pl,
splits this log using split_logs, analyzes all site logs using
webalizer_sites.pl and then performs logrotation, if necessary.  No part of the
logs should get lost by logrotation (or I am totally wrong ...).

Btw, logrotation happened on two of my sites this night, statistics still are
ok.

Sorry for my bad englisch ;-)

Best wishes,
Stefan