A few gotchas running AWStats on Debian_

October 26, 2017 @20:33

I have been trying to get AWStats running on my Debian 9.2 (Stretch) web server. It has been fighting me. This is as much a note for future me as it is for you.

To Start With

Now I don't think this is something I added to the stock Debian Apache config, but just in case this is my Apache LogFormat. It ends up writing out to /var/log/apache2/other_vhosts_access.log. This keeps all the logs for all the activity on the server in one place and makes things nice and neat. Of course the stock Apache LogFormat in AWStats assumes one domain per log file.

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined

So, to start I will assume you (future me) have done the usual apt-get update and apt-get install awstats dance by now, and have read /usr/share/doc/awstats/README.Debian.gz (if only to get the Apache config directives you need out of the sample config fragment).

I threw together a quick config with a SiteDomain set to www.going-flying.com but nothing happened. As forshadowing I will remind the reader that I recently setup HTTPS on that domain.

tl;dr...

The big gotcha is that %virtualname in AWStats matches the entire %v string from the Apache log, so basically ssl hosts need the :443.

In the base awstats.conf.local I have:

LogFile="/var/log/apache2/other_vhosts_access.log"
LogFormat = "%virtualname %host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot"
SkipHosts="localhost 127.0.0.1"

Then the magical incantation you want in your per-domain config files is:

Include "/etc/awstats/awstats.conf"
SiteDomain="www.example.com:443"
HostAlias="www.example.com example.com also.example.com"

🍺

Subscribe via RSS. Send me a comment.