Kieran Barnes / HTML, CSS, AJAX / Setting up awstats
Setting up awstats
I recently setup awstats on two Intranet servers for a client. Local web server log analysis software seems to be going the way of the Big-eared Hopping Mouse.
- Analog hasn't been updated in forever.
- Webalizer hasn't been updated in forever.
- Firestats is fantastic, I use this on Internet based sites with Google Analytics
* It's AJAX just doesn't like mod_auth_ntlm or the other way round.
I followed the included PDF file awstats.pdf which covers ninety percent of the process. There's a few caveats in the process. Here's how I did it.
tar zxpfv awstats-XX.tar.gz mv awstats-XX /usr/local/awstats mkdir /var/lib/awstats chmod 777 /var/lib/awstats cd /usr/local/awstats cd tools
Now we can run the config
perl awstats_configure.pl
I did the usual Y,Y,Y,Y and accepted all the defaults. Remember what profile name you set because you will need to add it into cron later.
55 23 * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=CONFIG-NAME
Lets edit the config file.
If you're on a closed server (not on the Internet) it's nice to have the following set
nano /etc/awstats/awstats.CONFIG-NAME.conf
Change the following two lines. The first, surprisingly allows you to update the statitics from the web browser and the second allows you to view a whole year. Both are disabled by default for safety reasons.
AllowToUpdateStatsFromBrowser=1 AllowFullYearView=3
There is an incosistancy in the awstats documentation with the DirIcons, the default config is
Change DirIcons="/icon"
But you will need to change that to
DirIcons="/awstatsicon"
so it matches the apache configuration further on.
Now, I wanted a complete historical reports from when my logs started. So the first thing I did was to run a report on my whole set of logs
Change the log file setting to look similar to this
LogFile="/usr/local/awstats/tools/logresolvemerge.pl /var/log/apache2/*.log |"
This reads the whole directory and does take some time. Once thats done you can change the LogFile setting to something a little more optimised like
LogFile="/var/log/apache2/access_log-%YY%MM%DD.log"
This assumes your apache is setup like this
CustomLog "|/usr/local/apache2/bin/rotatelogs /var/log/apache2/access_log-%y%m%d.log 86400" combined ErrorLog "|/usr/local/apache2/bin/rotatelogs /var/log/apache2/error_log-%y%m%d.log 86400"
This means I get a new log file every day.
Once you're happy with the setup, go ahead and run it
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=CONFIG-NAME
Watch out for any errors!
Finally, we can setup apache so we can view the logs. Because I am running this on a closed, single site server this config is going in my global. You may want to put them under a virtual host and/or add some security to them.
Add the following to your httpd.conf
Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/" Alias /awstatscss "/usr/local/awstats/wwwroot/css/" Alias /awstatsicon "/usr/local/awstats/wwwroot/icon/" ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"
<Directory "/usr/local/awstats/wwwroot"> Options None AllowOverride None Order allow,deny Allow from all </Directory>
Note there is another inconsitancy in the documentation, it stays
ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi.bin/"
Where really it should say
ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"
Now you should now have some nice reports to view over at
http://YOUR-SERVER/awstats/awstats.pl?output=main&config=CONFIG-FILE&framename=index
Related posts
- NTLM Authentication on Ubuntu and Apache2 Revisited
It's been a while since I've had to build an NTLM integrated Apache2 server. So... - NTLM Authentication for apt-get’ed Ubuntu
Following on from NTLM Authentication on Ubuntu and Apache2 Revisited this morning, this is how... - Setting up and using NFS on Ubuntu
Network File System, NFS, has been around since Noah first networked his ark. Setting up... - FreeTDS installation directory is not a FreeTDS installation directory
I recently discovered an error whilst trying to (re)install an older PHP version on a... - SSH Security Ramblings
SSH - Secure Shell isn't that secure. If you're not using it behind a Layer...
Posted by Kieran
Categories
- 4PSA VoIPNow (1)
- Apache (20)
- APC (1)
- Automotive (7)
- Client Sites (8)
- cPanel/WHM (22)
- CubeCart (23)
- Domains (1)
- Exchange (6)
- Geeky (32)
- General (22)
- Home (1)
- HTML, CSS, AJAX (23)
- IIS (1)
- Linux (79)
- MS SQL (4)
- Music (5)
- MySQL (19)
- nginx (4)
- Photography (17)
- PHP (93)
- phpBB (1)
- Reviews (4)
- Scalability (1)
- Search Engines (5)
- Security (6)
- Snippets (4)
- Software (4)
- Uncategorized (6)
- Vantegra (1)
- Virtualisation (1)
- VoIP (3)
- WHMCS (1)
- Windows (42)
- WordPress (64)
- Shopp (14)
- Xen (2)
Recent Comments
- Blue on Prevent images from displaying while loading with AnythingSlider
- jaysunn on MySQL 5.0 or 5.1 to 5.5 Upgrade Traumas on CentOS
- buy Synthroid on New Site: HSS Blog
- Minify CSS and JavaScript with nginx and embedded Perl on Minify CSS on the fly with nginx
- Yvo on MySQL: Can’t get hostname for your address
Kieran Barnes
Independent PHP, WordPress and CubeCart programmer and consultant in Manchester, UK.
I can offer programming and consultancy for your next WordPress, Ecommerce or PHP web application.
About Kieran
Kieran is a PHP developer with 15 years commercial experience. He has a niche for all things WordPress, CubeCart and other open sourcery. With expertise in most areas of Linux and Windows wrangling makes him a good choice for supporting and consulting your next web application.
Get in Touch



