You are not logged in.
OK class , I’m Jamal and today we are going to install a Web statistics analyzer called AWStats. These instructions will cover installing AWStats on Mac OS X Server. AWStats is a free download from www.awstats.org . AWStats reports on such things as browser type, bandwidth used , number of hits each page on your website is getting, etc... So, let’s get started.
Step 1: Go to www.awstats.org and download version 5.6 (the last stable version) to your desktop. Next, un-tar everything and move to step 2.
Step 2: OK, now we must get the Mac OS X log into the right format for our purposes. Please follow the instructions at http://www.afp548.com/Articles/web/apachelog.html to get your server logs in the right format otherwise AWStats will not work.
Step 3: From the AWStats folder that you un-tarred, copy awstats.pl, awstats.model.conf, lang, lib and plugins (they are in the cgi-bin sub-folder) to /Library/WebServer/CGI-Executables.
Step 4: Copy theicon folder into /Library/WebServer/CGI-Executables.
Step 5: Take a copy of awstats.model.conf open it and enter the following settings:
LogFile="/private/var/log/httpd/access_log"
LogFormat=1
DirIcons="/icon"
SiteDomain="www.mydomain.com"
Step 5: Change awstats.model.conf
name to awstats.mydomain.conf then put this file in CGI-Executables.
Step 6: Now, we must build and update our stats for the first time. To do this open Terminal and enter /Library/WebServer/CGI-Executables/awstats.pl -config=mydomain -update
You should see something like this:
Lines in file: 225730
Found 5 dropped records,
Found 124 corrupted records,
Found 0 old records,
Found 225601 new records
If you don’t see something like the above, try throwing away your current log file and restarting Web Services.
Step 7: Alrighty it’s time to view our stats for the very first time! To view them, open a browser and go to http://myipaddress/cgibin/awstats.pl?config=mydomain
Step 8: All you have to do now set cron to update your stats. For example:
0 * * * * root /Library/WebServer/CGI-Executables/awstats.pl -config=mydomain -update
will update your stats every hour. If you need help setting up cron , go to www.koch-schmidt.de/cronnix/ and download Cronnix.
Note: If you want to monitor a specific site you need to enter: LogFile="/private/var/log/httpd/mydomain and restart Web Services.
Be sure that /etc/httpd/httpd_macosxserver.conf says
CustomLog "/private/var/log/httpd/mydomain" combined
if you want to monitor a specific site.
You can get more details about the set-up of AwStats from the AWStats set-up docs.
We are finished, now “get up on it shawty!”
Offline
I just stumbled onto your article literally minutes after getting AWStats running on my own. I am having a bit of trouble getting it all to work with rotatelogs though. Here's what I have done:
1) Change the rotatelogs command in httpd_macosxserver.conf so that it uses logfile names in the pattern mysite_log.YYYYMMDD. I have logs set to rotate daily. The default suffix of the system time was impossible to make work with AWStats. I am still getting some weird timezone offset errors (the date changes before it is supposed to - I have no idea why).
2) Set the logfile name in awstats.mysite.conf to look for the logfile with date appended.
Now there is a problem with periodic/daily that purged old logfiles by looking for the system time as the suffix... I can fix that later though, or purge old logs manually.
The problem with rotatelogs is that it gzips the current logfile and a new one doesn't seem to be created. What's more, it changes the ownership on the logfile and no further entries are added, even after gunzipping the file. It looks like apache doesn't have permissions to create a new file in /var/log/httpd.
Is there an easy way to script apache logfile rotation to avoid these problems? I am ready to leave rotatelogs for something else since it has been the source of so much grief.
Miles
Offline