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.analog.cx/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
The installI used the port. And 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
The documentationThis 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. See /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.
The configurationOnce 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 /path/to/freebsd-access.log # to set where your logfile lives OUTFILE /path/to/freebsd-usage.html # to send the output to a file # instead of the screen HOSTNAME "NZ FreeBSD Mirror" HOSTURL www.nz.freebsd.org
Common errorsWell, they may not be common errors, but I made them <grin>.
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 analogHere’s how I ran analog for the first time:
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.
Thank You very much for this article.
This article is exactly that I needed. After the long searches I found searched.
You are welcome.
The Man Behind The Curtain