# pacman -S mod_perl
Awstats package is available in AUR. You can use yaourt to build it or you can obtain tarball from AUR and build it yourself.
$ yaourt -S awstats
Enable mod_perl for Apache
To enable Template:Codeline in apache, you should add following line to apache configuration (/etc/httpd/conf/httpd.conf).
LoadModule perl_module modules/mod_perl.so
Configure Apache to log for Awstats
By default awstats requires Apache to record access logs as 'combined'. Unless you want a different behavior, you should set your access log format as 'combined'. To do so, your apache configuration should look like this:
<VirtualHost *:80> ServerAdmin firstname.lastname@example.org DocumentRoot "/srv/http/xxx" ServerName www.returnfalse.net ErrorLog "/var/log/httpd/returnfalse-error_log" CustomLog "/var/log/httpd/returnfalse-access_log" combined </VirtualHost>
The important line here is:
CustomLog "/var/log/httpd/returnfalse-access_log" combined
Including Awstats Configuration to Apache's Configuration
If you set the log format, then next step is including awstats config file to apache. The package in AUR has a default one, and it's working without any problem. But incase you want to create your own configuration, default one is this:
Alias /awstatsclasses "/srv/http/awstats/classes/" Alias /awstatscss "/srv/http/awstats/css/" Alias /awstatsicons "/srv/http/awstats/icon/" ScriptAlias /awstats/ "/srv/http/awstats/cgi-bin/" <Directory "/srv/http/awstats"> Options None AllowOverride None Order allow,deny Allow from all </Directory>
Include this file (in AUR case, the path is /etc/httpd/conf/extra/httpd-awstats.conf) to apache's main configuration:
Now if you have done all steps correctly, you should be able to see awstats running on http://domaincomeshere.com/awstats/awstats.pl of course after restarting apache.
# /etc/rc.d/httpd restart
One last thing, which is the actual aim, make awstats read logs and convert them to stats.
Package in AUR comes with a out of the box hourly cron to update stats shown on awstats. This cron script reads awstats configuration files in Template:Codeline and updates the stats for the sites that are defined in these configuration files. Instead of creating these configuration files, you can use awstats' configuration tool. Run:
and follow the instructions. If you are successfully created config file there is one thing that you should modify manually. Open the configuration file created by Template:Codeline with your favorite text editor. Then find the line on which Template:Codeline variable is defined, and set it as the path that apache logs accesses (which you set to be logged as 'combined' format before):
You are done, now you can run hourly cron script to test the results.