## Tracking Visitors ## Dan Langille If you are running a web server, it can be useful, if not just fun, to know how many hits your website is getting. This article will show you how to install a logfile analyser. analog - "The most popular logfile analyser in the world" Well, that's not my claim, but you can read it for yourself at http://www.monash.edu.au/mirror/analog/survey.html and make up your own mind. But what I can say is that analog is a good tool and it is free. This article will show you how I installed and configured analog. It's pretty easy, but there are no man pages for it. Just html. The home page for analog is: http://www.statslab.cam.ac.uk/~sret1/analog/ A sample of the output is at: http://www.statslab.cam.ac.uk/~sret1/stats/statsme.html Installation I used the port. With ports, it's very easy to install stuff. It's mindless-no-thinking stuff. Someone else has already done all the hard work for you. For full port installation instructions, please see 'Getting a FreeBSD Port' in the FreeBSD handbook. In short, I did the following: # cd /usr/ports/www/analog # make # make install Documentation This was the difficult part. It's not that the information is not provided. It's that I found the information difficult to find. My first attempt was the man pages. But there are none for analog. Man pages are great in that they always provide the basic command line arguments. And it was this information which I wanted. I was lost. So I went back to the install output and found that it had copied files to /usr/local/share/doc/analog/. Of course! I should have known. That's a pretty standard place to put documents, as you can tell the from the name. In fact I went there and found only html files. And if you click on /usr/local/share/doc/analog/Readme.html it will take you to those documents if they exist on your local machine. NOTE: Shortly after I wrote this article, Nik Clayton gave me a tip on how to determine what a port has installed . Configuration Once I'd found the documentation, it was just a matter of reading and trying to understand it. Here's what I created for my /usr/home/dan/analog.cfg file: LOGFORMAT (%S - %u [%d/%M/%Y:%h:%n:%j] "%j %r %j" %c %b) LOGFILE /usr/home/dan/public_html/freebsd-access.log OUTFILE /usr/home/dan/public_html/freebsd-usage.html HOSTNAME "NZ FreeBSD Mirror" HOSTURL www.nz.freebsd.org In the above, the 'LOGFILE' should be set to where the logfile you want to analyze lives, and OUTFILE should be set to the file you want to print the results to instead of the screen. Common Errors Well, they may not be common errors, but I made them . You must specify the LOGFORMAT before the LOGFILE. This is documented, but I still missed it. If I didn't, I got this error: analog: Warning D: LOGFORMAT in configuration file analog.cfg with no subsequent LOGFILE If I didn't specify LOGFORMAT then I got these errors: analog: Warning F: Can't auto-detect format of logfile /var/log/apache/freebsd-access.log: ignoring it (For help on all errors and warnings, see docs/errors.html) analog: Warning R: Turning off empty time reports analog: Warning R: Turning off empty Request Report analog: Warning R: Turning off empty File Type Report analog: Warning R: Turning off empty Directory Report analog: Warning R: Turning off empty Domain Report analog: Warning R: Turning off empty Referrer Report analog: Warning R: Turning off empty Referring Site Report analog: Warning R: Turning off empty File Size Report analog: Warning R: Turning off empty Status Code Report Running Analog Here's how I ran analog for the first time: analog -ganalog.cfg The -g means to use the configuration file specified. Note: there is no space after the -g and before the name of the configuration file. For more information on the configuration options, please refer to /usr/local/share/doc/analog/syntax.html. Enjoy, - Dan $Id: analog.txt,v 1.1 2000/02/16 08:07:52 jim Exp $