I had the issue of going back and wanting to process all the old Apache log files using AWStats when the web server had already been running for a while and logrotated had been busy archiving them. This particular server runs the site http://portal.bristolwireless.net on a server running Debian and Apache2.
I used this one-liner to deal with all the archived gzip files:
% cd /var/log/apache2
% for i in `ls -tr access.log*.gz`; do gunzip $i; /usr/lib/cgi-bin/awstats.pl -LogFile=/var/log/apache2/`echo $i | replace '.gz' ''` -config=portal.bristolwireless.net -update; gzip `echo $i | replace '.gz' ''`; done
Now there's just the one uncompressed file to do:
% /usr/lib/cgi-bin/awstats.pl -LogFile=/var/log/apache2/access.log.1 -config=portal.bristolwireless.net -update
And then run it as normal (which defaults to /var/log/apache2/access.log in this case):
% /usr/lib/cgi-bin/awstats.pl -config=portal.bristolwireless.net -update
Et voila!
Sunday, December 21, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment