How to setup awstats-Web Analyser

AWSTATS is an Apache log file analyzer that will show details about traffic to your web sites.

Setting up awstats guide

now run the awstats.pl script:
% cd /usr/share/awstats/wwwroot/cgi-bin/
% sudo perl awstats.pl -update -config=mysite

If all goes well, you should see something along the lines of:
Found 0 dropped records
Found 0 corrupted records,
Found 150 old records,
Fount 50 new qualified records.

…at the end of the update script output.

So, to do this with multiple domains, just repeat the steps above, making sure to make the appropriate changes to each domain…

This will hopefully create a config file fore each of your domains in /etc/awstats with the name awstats.web3us.com.

You should now be able to visit www. yoursite.ext/awstats/awstats.pl?config=mysite and you’ll see the fruits of your labor. I chose not to allow web users to do automatic updates. Rather, I have a cronjob set to run the awstats.pl -update script a once per day
(I don’t administer any high-traffic sites, so it’s not critical to have the most up-to-date records). You can see near the end of my Incremental backups with rsync post for more information on that, if you’re interested.

A word of caution: AWStats is often the target of worm attacks through XSS (cross-site scripting). One reason to use Yum to install/manage awstats is that you don’t have to do any of the work to keep it updated (make sure you enable automatic yum updates in your systems services config (menu: Desktop->System Settings -> Server Settings -> Services; check the “yum” option is checked and you click the “Start” button while it’s highlighted). Also make sure to limit who can see the awstats reports.

Process logs: Building/updating statistics database

Update from command line (recommended):

The first log analysis should be done manually from the command line since the process may be long and it's easier to solve problems when you can see the command output (if you don't have Command Line access, skip to Step 2). The AWStats create (and update) statistics database command is:

 

perl awstats.pl -config=mysite -update


where mysite must be substituted with the domain/virtual host name you selected earlier during AWStats configuration.

AWStats will read the configuration file awstats.mysite.conf (or if not found, awstats.conf) and create/update its database with all summary information issued from analyzed log file.

AWStats statistics database files are saved in directory defined by the DirData parameter in configuration file.
When the create/update is finished, you should see a similar result on your screen:

Run reports: Building and reading reports

To see the analysis results, you have several options depending on your security policy.

Note: you must have created a statistics data base for the analysis period by processing your log files before you try to create reports.  See the previous section.

1. The first option is to build the main reports, in a static HTML page, from the command line, using the following syntax (skip to the second option if you only have CGI access):

 

perl awstats.pl -config=mysite -output -staticlinks > awstats.mysite.html


where mysite must be substituted with the domain/virtual host name you selected earlier during AWStats configuration.

 

Run the following:

sudo perl /usr/share/tools/awstats_configure.pl

Add the following to a script to add new log entries:

sudo /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -update -config=slyfoxsos

run the following as root, (sudo will not work)

/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=slyfoxsos -output -staticlinks > awstats.slyfoxsos.html

View Report at:

orasos/awstats/awstats.pl?config=orasos

Includes many charts and tables about traffic to your site.

AwStats

Subject