Use Analog to Process Logfiles





Use Analog to Process Logfiles

Analog is purportedly the most popular web server logfile analyzer in the world. If you're just getting your feet wet in web measurement, you might want to give it a quick try.

Analog, written by Dr. Stephen Turner (one of the original web measurement hackers), is an easy-to-install and highly flexible web server log analyzeone that hundreds of thousands of people have likely tried at one time or another just to get a taste of web measurement. Since it's completely free, you might want to take the time to download and install the application and generate a few reports just for fun.

Analog: Where to Get It!

Analog is made freely available by Dr. Turner at www.analog.cx. At the time this book was written, versions of the application were available for Windows; Macintosh OS 8, OS 9, and OS X; dozens of flavors of Unix, including BSD, Linux, HP-UX, and Solaris; and a motley collection of non-Unix platforms like BeOS, Novell Netware, and OpenVMS. You can also download the source code to compile on any known platform, if it suits your fancy.

Visit http://www.analog.cx/download.html and select the version of Analog that works best for you.

How to Install Analog

Once you've downloaded the application, on most platforms all you need to do is extract it using whichever application you normally use to extract archives. The archive will uninstall into an install directory, usually analog version], where [version] is the version of Analog you've downloaded. For example, if you downloaded Analog Version 6.0, you're going to end up with a directory called analog 6.0.

To test your installation, simply navigate to the directory created and run Analog in the normal way for your operating system. For example, on Linux, you would just type ./analog, and on Windows, you would click on the executable analog.exe. In Windows, a DOS window will open and close, but a report file called Report.html should be created in the analog directoryone that when opened will present you with a sample report. If something went wrong, look for the errors.txt file, open that, and look for an explanation of what went wrong.

Telling Analog Where Your Logfiles Are

Analog doesn't have a Windows-style user interface. Instead, you configure it by putting commands in the configuration file analog.cfg. The first thing you need to tell it is where your web server logfiles can be found. The command for selecting a logfile is

		LOGFILE logfilename

You can have several LOGFILE commands, and you can also include wildcards in the logfile name. For example, on Windows, you might use the command:

	LOGFILE C:\WINDOWS\system32\Logfiles\W3SVC1\*.log

Creating Basic Reports in Analog

Once you've told the application where to look for your logfiles, all that's left is to generate basic reports based on those logs. The most basic command to get Analog to create a report is simply to click on analog.exe or run it from the command line. Still, Analog is very powerful, and you may choose to modify the reports to suit your specific needs in hundreds of different ways. Here are a handful of commands you can place in the analog.cfg to modify your reports:


OUTFILE {filename}

You can use the OUTFILE command to change the name of the report generated from Report.html to anything you like.


HOSTNAME and HOSTURL

You can use the HOSTNAME and HOSTURL commands to change the name and URL at the top of the reports you generate. Use the following format:

	HOSTNAME "Web Analytics Demystified"
	HOSTURL http://www.webanalyticsdemystified.com/


LANGUAGE {language}

You can change the language in which the report is written to any of over 30 languages. For example:

	LANGUAGE UKRAINIAN

For a more complete list of basic commands that can be issued to Analog, visit http://www.analog.cx/docs/basiccmd.html.

Running the Hack

Once you've successfully downloaded and installed Analog, simply execute it on the command line. On a Windows system, for example, simply type analog.exe on the command line. The program will read the configuration file and place its output in a file called Report.html (or the file specified in the OUTFILE setting in analog.cfg). You can then open this report in a web browser to see the results. Figure shows a typical example.

Hourly summary report from Analog


Consider combining Analog with Report Magic (www.reportmagic.org) to improve the visual appeal of the reports (Figure).

Analog is a simple but powerful web measurement applicationone that will perhaps satisfy your entry-level needs if you're just getting into web data analysis.

Dr. Stephen Turner and Eric T. Peterson


     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows