Jump toUpdate content
AwStats - Overview
AwStats is a handy tool that can give you an overview of what is happening on your website and assist with site analysis. It is an open-source Web analytics reporting tool that graphically generates advanced web, streaming, FTP, or mail server statistics.
It is a complete enterprise-grade server and log monitoring software that works either as a CGI (Common Gateway Interface) or from the command line. It displays all the information in your logs via a series of concise, graphical webpages, running regularly and quickly.
AwStats uses log file analysis to analyze log files from most web servers, including Apache, IIS, and many other web servers.
You may need certain IAM permissions to carry out some actions described on this page. This means:
- you are the Owner of the Scaleway Organization in which the actions will be carried out, or
- you are an IAM user of the Organization, with a policy granting you the necessary permission sets
- You have an account and are logged into the Scaleway console
- You have configured your SSH key
- You have created an Instance
- You have sudo privileges or access to the root user
We recommend you follow this tutorial using a Cost-Optimized Instance.
Connect to your Instance:ssh root@<your_Instance_public_IP>
Make sure the Apache2 HTTP server is installed, then install the AwStats server packages:apt updateapt install apache2
Installing and configuring AwStats
By default, AwStats package is available in the Ubuntu repository.
Install the AwStats package.apt install awstats
Enable the CGI module in Apache.a2enmod cgi
Restart Apache.systemctl restart apache2.service
Duplicate the AwStats default configuration file to one with your domain name.cp /etc/awstats/awstats.conf /etc/awstats/domain-example.conf
Edit your AwStats domain name configuration file.nano /etc/awstats/domain-example.conf
Update the settings shown below.# Change to Apache log file, by default it's /var/log/apache2/access.logLogFile="/var/log/apache2/access.log"# Change to the website domain nameSiteDomain="domain-example.com"HostAliases="www.domain-example localhost 127.0.0.1"# When this parameter is set to 1, AwStats adds a button on report page to allow to "update" statistics from a web browserAllowToUpdateStatsFromBrowser=1
CTRL + Oand
CTRL + Xto save and exit the file.
Build your initial statistics which are generated from the current logs on your server./usr/lib/cgi-bin/awstats.pl -config=test.com -update
which returns...Create/Update database for config "/etc/awstats/awstats.conf" by AwStats version 7.6 (build 20161204)From data in log file "/var/log/apache2/access.log"...Phase 1 : First bypass old records, searching new record...Searching new records from beginning of log file...Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...Jumped lines in file: 0Parsed lines in file: 5Found 0 dropped records,Found 0 comments,Found 0 blank records,Found 0 corrupted records,Found 0 old records,Found 5 new qualified records.
Configuring Apache for AwStats
Copy the content of the
cgi-bin folder to the default document root directory of your Apache installation. By default, this is in the
cp -r /usr/lib/cgi-bin /var/www/html/chown www-data:www-data /var/www/html/cgi-bin/chmod -R 755 /var/www/html/cgi-bin/
Now you can access your AwStats by visiting the following URL:
Setting-up a cron job to update logs
It is recommended to schedule a cron job to regularly update the AwStats database using newly created log entries, so the stats get updated on a regular basis.
- Edit the
- Add the following line to tell AwStats to update every ten minutes
*/10 * * * * root /usr/lib/cgi-bin/awstats.pl -config=test.com -update
CTRL + Oand
CTRL + Xto save and exit.