awstats (statistical reporting)
This goal of this readme is to provide a very quick and basic installation of the “awstats” application. By clicking on the link/image above you will be taken to the official website. By clicking on the Doc/FAQ link you will be taken to the official documentation in html or pdf format. You should read this document to get the most out of “awstats”.
Prerequisites:
- you are using the rpm version of the Apache webserver
- you are using the rpm version of “awstats”
- Apache has been configured to use the LogFormat combined directive (see the Apache readme)
- MAKE A BACKUP OF YOUR Apache httpd.conf file – NOW
Configuration Assumptions:
- your site is www.mysite.org
- you are configuring awstats for a blog (the Apache readme assumes this)
What will happen:
- you will run an “awstats” script which will
- modify your httpd.conf file ( the reason for backing it up) . If you have not made any changes to your httpd.conf file you will not have problems but if it has been customized this script will not correctly insert the code necessary for “awstats”. See the Apache readme for how it should look if using a virtual site.
- generate a “awstats” configuration file in /etc/awstats like awstats.www.mysite.org.conf
Steps:
- cd /usr/share/awstats/tools
- perl awstats_configure.pl (you will be prompted for input)
- for the name of the configuration file enter www.mysite.org
- the script will run to completion
- go to /etc/awstats and look at your configuration file.
- view the file paying attention to the following entries
- LogFile – full path to your server log file
- LogType – should be “W”
- LogFormat – should be 1. (awstats is expecting a “combined” format – see the Apache readme
- SiteDomain – www.mysite.org
- cd /usr/share/awstats/wwwroot/cgi-bin
- perl awstats.pl -update -confi=www.mysite.org
if this runs correctly you will see something like
Update for config “/etc/awstats/awstats.mysite.conf”
With data in log file “/pathtoyourlog/yourlog.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: 0
Parsed lines in file: 225730
Found 122 dropped records,
Found 87 corrupted records,
Found 0 old records,
Found 225521 new qualified records.If you get errors then probably it is due to the format of your access log not being of the format awstats is expecting. If you been running Apache for a while and the format was set to “common” in the httpd.conf file then you will have to go into your awstats configuration file and change the LogFormat entry to 4 and rerun this script. The problem though is that all of the functionality of “awstats” is based upon the “combined” format of the log file. To my knowledge there is no way to convert a “common” access log to “combined” acces log. If you have changed Apache for the “combined” format then you can stop Apache and rename your access log file to another name, start Apache, and it will generate a new access log with the correct format for the default LogFormat awstats expects. Note: the official document for “awstats” provides a method of how to capture statisics for the “common” log then switch to the “combined” logging format so that you don’t loose any statistical data. This is discussed in the Q&A/FAC of the document.
- point your browser at httpd://www.mysite.org/awstats/awstats.pl?config=www.mysite.org
- and you should see your statisics – if you had to restart Apache to generate a new log then you will not see much in the way of statistics
- generate a crontab entry to run awstats every day at 2 am or more frequently if desired
- 00 02 * * * /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.mysite.org > /dev/null
- to have country data entered into “awstats” reporting three items are needed:
- go to http://www.maxmind.com/app/c and dwon load the “Download C API now” files. unzip and extract the file. Follow the instructions in the INSTALL file.
- go to http://search.cpan.org and search for geoip. You want the one that looks like Geo::IP. Download this file and unwind it. Then extract the data. Follow the instructions in the INSTALL file.
- move the GeoIP.dat file to /etc/awstats and vi your awstats.www.mysite.org.conf file to point to where the GeoIP.dat file is and to enable the plugin for GeoIP.
- The next time your crontab executes your country codes will be present in the output.This concludes this readme. While I have attempted to cover the basic installation steps there is no substitute for reading the html/pdf document for “awstats”. It is approximately 98 pages in length and covers installation in greater detail as well as many other functions/features available.
Entries (RSS)