Create a traffic report from the AWStats database.
Some traffic reports, such as the online today one, are cumulative. Every time the today report is updated, the new information is added on with the old in the AWStats database (in the statsdata directory). So this means when you look at today you may be looking at several days worth of information.
We use awstats_buildstaticpages.pl to create all our reports. You can see the command line options in the relevant batch files in the mytools directory.
For the today we use awstats.pl to generate today's traffic report and need to update manually using the Update now link.
The report generation is explained in further detail.
There are two methods to generate reports. Either by using awstats.pl directly or by using a helper script, named awstats_buildstaticpages.pl.
To generate the main report for July 2008 using
awstats.pl
, you can issue the following command:
perl LOCALPATH/awstats/wwwroot/cgi-bin/awstats.pl -config=mysite -month=07 -year=2008 -output -staticlinks > LOCALPATH/monthly/awstats.mysite.200807.html
If the options -month
and -year
are
omitted, then the report is generated for the current month. You
can also generate a report for a whole year, by setting these
two options to -month=all and
-year=2008.
You can view the page with your web browser at:
http://www.mysite.com/traffic/awstats.mysite.200511.html
Furthermore, you can create supplemental reports (lengthy lists of referrers, countries etc.) or even apply filters. This info is covered in detail in the awstats documentation. See the relevant section here.
A quick way to create full reports (main and supplemental pages) is to use the helper script, awstats_buildstaticpages.pl. This can be used in the following way (example from monthly batch file):
perl "LOCALPATH\wwwroot\cgi-bin\awstats_buildstaticpages.pl" -config=07.2008 -update -month=07 -year=2008 -awstatsprog="LOCALPATH\wwwroot\cgi-bin\awstats.pl" -dir="LOCALPATH\monthly"
All the reports are generated in the monthly directory with awstats.07.2008.html as the main page.
Here is an explanation for some of the options:
-configdir: Sets the path of the directory
which contains the configuration files.
-awstatsprog: Sets the path to the
awstats.pl
script.
-dir: Sets the directory where the report files
should be saved.
-builddate: Adds month and year info in the
report’s filename.
Again, if the options -month
and -year
are omitted, then the report is generated for the current month
and year.
Other options that can be used are:
-update: Updates the awstats statistics
database before generating any reports.
-buildpdf: Creates a PDF file, after the
generation of the HTML pages is done.
In order to generate PDF files, the package htmldoc needs to be installed in the system.
Enter the path to the online awstats.pl script and the appropriate name of the config file:
http://www.mydomain.com/awstats/wwwroot/cgi-bin/awstats.pl?config=today
This will bring up the AWStats screen. All the information shown is gathered from the AWStats database as specified in the config file.
Next: Analyze traffic report