Your Webpage Stats

From Redbrick Wiki
Jump to navigation Jump to search

So you want to see the statistics for your webpage?

This no longer works because of permissions

To see the logs for all the webpages on redbrick, 'ssh <strike>murphy</strike> pyg' and then look in '/var/log/apache2'. The logs are split up by year, date and type. So the access logs for the 8th of March 2008 would be found at '/var/log/apache2/2008/03/08-combined_log'. You can pipe any of the logs to 'grep /~username' to pick out information on your own page.

If your using a vhost (i.e. your own web domain) on redbrick you won't be able to pick out hits to your domain using the grep method above. You should ask the admins to generate logs for your domain. Sometime in the future, the combined logs may be configured to handle these web domains.

If you want a more graphical representation, you can use a tool like awstats. ryaner generates awstats for all of Redbrick.

Using AWStats

Install AWstats into your webpage as instructed but you will use different options for when you run ''. You must run '' on 'deathray'.

For 'Do you want to continue setup from this NON standard directory [yN] ?' answer 'y'.

For 'Config file path ('none' to skip web server setup):' answer 'none'.

For 'Do you want me to build a new AWStats config/profile file (required if first install) [y/N] ?' answer 'y'.

For 'Your web site, virtual server or profile name:' answer ''.

For 'Directory path to store config file(s) (Enter for default):' answer the directory containing the ''. This might be something like '/webtree/c/cammy/awstats/wwwroot/cgi-bin'. This directory will be where the profile is created.

Let the script finish.

Now there should be a '' created in the same directory as '' (depending on your options). You'll need to configure a few things within it to get it to work. Open it in your favourite text editor.

Set the 'DirData' option to 'DirData'"."'. This will generate the data files in the same place as the '' script. The default location is invalid.

Set the 'SiteDomain' option to 'SiteDomain=""'

Set the 'LogFile' option to 'LogFile="/var/log/apache2/%YYYY-0/%MM-0/%DD-0-combined_log"'.

If you want to gather stats for more than a day, say the whole month, then replace the 'LogFile' option with this: 'LogFile="/pathtotools/ /var/log/apache2/%YYYY-0/%MM-0/*-combined_log |"'. Replace 'pathtotools' to point to where you installed the awstat tools directory. Be warned, this will slow down the update process by a few minutes. BTW, before '' will run, you'll have to change the permissions to excutable, i.e. 'chmod 755 /pathtotools/'.

If you want only your logs you can use 'grep' to do it. Change 'LogFile' to 'LogFile="grep /~username /var/log/apache2/%MM-0/%DD-0-combined_log |"' and change 'username' to your username to get only your hits. (Rememeber this does not work for vhosts though you can write a script that combines vhost logs with these logs etc.)

If you've kept the same directory structure from the awstats archive and uploaded it to your web space in some subdirectory, you may notice none of the icons appear. Change the option 'DirIcons' to 'DirIcons="../icon"'.

There are also a number of plugins avaliable on Redbrick that can be used by awstats. Update the 'LoadPlugin' options with these settings:

LoadPlugin="geoip GEOIP_STANDARD"

Of course, you can also set or change any other options you want.

Make sure the permissions are correct on the script. 'chmod 755 /pathtoawstats/'.

Now, as per the original instructions for AWStats, you can do a initial update of the logs (i.e. ' -update'). This must be done on 'deathray' just like the configure script. This will compile the stats from the logs selected by the 'LogFile' option.

You can then generate static html pages or load it all up dynamically as per the awstat setup documentation.