The following is the GNU All-permissive License as ommended in https://www.gnu.org/licenses/license-recommendations.en.html
Copyright (C) 2024 Free Software Foundation sysadmin@fsf.org
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.
Contributions are welcome. See https://savannah.gnu.org/maintenance/fsf/.
awstats
See cluestick Termite.fsf.org for info setting up on old hosts.
Adding a machine to awstats
Example vhost.fsf.org
and IP address is 555.555.555.555
- Make a new VM and add it to either the
[apache]
or[nginx]
category ofansible
'sinventory
file. - Login to termite.
ssh root@termite.fsf.org
- Copy a known good config.
cp /etc/awstats/awstats.jshelter.org.conf /etc/awstats/awstats.vhost.fsf.org.conf
- Change the host name.
sed -i 's/jshelter.org/vhost.fsf.org/g' vim /etc/awstats/awstats.vhost.fsf.org.conf
- Change the IP address.
sed -i 's/209.51.188.122/555.555.555.555/g' vim /etc/awstats/awstats.vhost.fsf.org.conf
- Test your config.
/usr/lib/cgi-bin/awstats.pl -config=vhost.fsf.org -update
- Check that your files are in
/var/log/vhosts/555.555.555.555/
.ls /var/log/vhosts/555.555.555.555/
- Edit the webpage to point to your new server.
vim /var/www/html/index.html
- Exit.
exit
- Open the https://termite.fsf.org/ page and view your new server stats! :D
On GNU Hope
We don't need logpp
, because apache and nginx automatically log to syslog, as
long as you are using the logging configuration suggested by ansible. note that
changes to web server's site config are not enforced by ansible, so make sure
that you have the proper logging config enabled. make sure that you have
something like the following.
/etc/syslog-ng/conf.d/00load-fsf-termite.conf
is automatically
copied to apache and nginx vms.
It needs to be local4.info
.
CustomLog "|/usr/bin/logger -t apache -p local4.info" combined
When migrating an old VM, that uses awstats, to a new machine, edit the
LogFile
directive on termite.fsf.org
in
/etc/awstats/awstats.directory.fsf.org.conf
, for example, to point to the new
log file.
Notes
Our Awstats config ignores IPv4 requests that originate from the FSF office.
Documentation
Awstats glossary: https://awstats.sourceforge.io/docs/awstats_glossary.html
Debugging
Before running Awstats commands, ensure that Awstats isn't running. It runs every 10 minutes.
ps -ef | grep -i awstats
If you want to know why some records are ignored by Awstats:
sudo -u www-data /usr/local/awstats-7.6/wwwroot/cgi-bin/awstats.pl -config=ryf.fsf.org -update -showdropped | less
Also useful:
/usr/local/awstats-7.6/wwwroot/cgi-bin/awstats.pl -help | less
Cron job:
sudo -u www-data /usr/local/bin/awstats-update.sh
Alerts
klaxon:/usr/local/bin/nagios_check_termite.sh
Robots definition updates
git clone https://github.com/eldy/awstats
cd awstats
scp termite.fsf.org:/usr/share/awstats/lib/robots.pm /tmp
meld /tmp/robots.txt robots.pm
# if there are updates, let fsf-all@fsf.org know that stats may change.
scp robots.pm termite.fsf.org:/usr/share/awstats/lib/robots.pm