logrotate all httpd log files - prerotate with awstats?

GoranTornqvist

Verified User
Joined
Sep 13, 2004
Messages
58
Location
Stockholm
On of our customers noticed that he had "holes" in his awstats statistics (days with no stats). I noticed that we were running awstats_updateall.pl at excactly 00:00 which is the same time that DA rotates httpd logfiles that reached the 5 MB limit, right?
I think the problem was that the logfiles were rotated before awstats had the chance to parse them.
I've changed so awstats_updateall.pl is running at 23:45 now which should do it. But i was thinking that it much better to do this with logrotate prerotate option, like:

/var/log/httpd/domains/*log {
rotate 3
size=5000k
prerotate
awstats_updateall.pl now -awstatsprog=/usr/local/directadmin/plugins/awstats/hooks/cgi-bin/awstats.pl > /dev/null 2>&1
endscript
postrotate
killall -HUP httpd
endscript
}
But it lookes like DA doesn't use logrotate...what I can see the logfiles is rotated with task.queue. Does task.queue support using prerotate? Any solution to my problem...or do I just have to run awstats at 23:45 like I do now?
 
Last edited:
Solution:

Change:

10 0 * * * root echo 'action=tally&value=all' >> /usr/local/directadmin/data/task.queue

to be:

10 0 * * * root /command/run/for/awstats; echo 'action=tally&value=all' >> /usr/local/directadmin/data/task.queue;

in the /etc/cron.d/directadmin_cron
 
Back
Top