This README describes analog0.92beta. For the latest version of analog, see the analog home page.
This program analyses logfiles in both the common log format and NCSA old format from WWW servers. It is designed to be fast on long logfiles and to produce attractive statistics. For more details, see the
-uoption, and subdomain analysis.
analog.c The program. analogo.gif A logo for the top of the output. analhead.h A header file, with various settable options. domains.tab A file matching internet domains to their locations. Makefile A Makefile
LOGFILE, and will want to change
HOSTURL. You can change any of the rest to your desires, but equally it's probably OK to leave them as they are, at least at first.
You don't need to know about the domains.tab file (as long as you've got one) or configuration files (at all). If you just want to try out the program, you can go straight to the section on compiling and running.
ad Andorra ae United Arab Emirates [...]There can be arbitrary space between the code and the corresponding location. The codes are converted to lower case. Use
?(or anything starting with
?) for the name if you want the domain to be recognised, but don't want the name to be printed out. Subdomains can also be analysed in the domain report. They are specified in the configuration file. Comments can occur in the domains file. They are introduced by the character
#. So you could write, for example,
uk United Kingdom # God save the Queen
When analog starts running, it can read instructions from a configuration file (or from stdin). At the moment the following instructions that can be in this file. (You are welcome to suggest others for the wishlist).
FILEALIAS file1 file2Whenever
file1occurs in the logfile, it is to be replaced by
file2. Analog already understands that
/dir/index.htmlis the same as
/dir/and translates `escaped' entities (e.g.,
%7Eis the same as
~) so these don't need to be specified separately.
* is placed at the end of the first entry, then all
filenames starting with
file1 will be changed to start
file2. So, for example, after the command
FILEALIAS /~sret1/statprog/* /~sret1/analog/a filename looking like
/~sret1/statprog/statprog/stat.cwill be understood as
/~sret1/analog/statprog/stat.c. (Note that the conversion is done only once for each filename; you don't get
The second command that can occur in the configuration file is
HOSTALIAS host1 host2This is useful if your server records local hosts in the logfile instead of full internet names. Also, if a host has two names, they can be combined in this way. So, for example, I might find it convenient to use
HOSTALIAS lion lion.statslab.cam.ac.uk HOSTALIAS www lion.statslab.cam.ac.uk HOSTALIAS www.statslab.cam.ac.uk lion.statslab.cam.ac.ukAgain, only one conversion is done per host, which is why I need both the second and the third line.
Next there are some commands for analysing only part of the logfile. Use of these commands can slow the program down a bit. The command
FILEIGNORE filenameignores altogether logfile entries due to certain files. Again, an asterisk (
*) can appear at the end of the name. Another command
FILEONLY filenamelooks at only that file. If two
FILEONLYcommands appear, the program will look at entries matching either of them. For example
FILEONLY /~sret1/* FILEONLY /~sret2/* FILEIGNORE /~sret1/backgammon/* FILEIGNORE /~sret2/home.htmlwill look at my files and
sret2's files, but not my backgammon files or
sret2's home page. These commands are applied after any aliasing of filenames has been done, but the files given in these names are not subject to any aliasing.
There are similar commands for including or excluding certain hosts. For example,
HOSTONLY *.statslab.cam.ac.uk HOSTIGNORE lion.statslab.cam.ac.ukwill only include hosts from my local site, but not
lion.statslab. In this case,
*.statslab.cam.ac.ukmatches the host
statslab.cam.ac.uk. If you want to exclude it, you can give a
HOSTIGNOREline for it.
Next there are commands to analyse only the logfile entries from
certain dates. The commands are
FROM yymmdd and
TO yymmdd. So, for example, if I wanted to analyse
only requests in June 1995 I could use the configuration
FROM 950601 TO 950630
There is a command
SUBDOMAIN to analyse subdomains within
the domain report. The syntax is
SUBDOMAIN subdomain subdomain_nameIf the subdomain name has spaces in, it must be enclosed in quotes. The symbol
?can be used as the subdomain name, indicating a nameless subdomain. For example, I typically run analog with a configuration file including the lines
SUBDOMAIN cam.ac.uk 'University of Cambridge' SUBDOMAIN statslab.cam.ac.uk ?which produces output like
103118 : 46.60% : .uk (United Kingdom) ( 64975):( 35.46%): cam.ac.uk (University of Cambridge) ( 47133):( 20.56%): statslab.cam.ac.uk 49271 : 12.49% : .edu (USA Educational)Numerical subdomains (which have most significant part on the left) can also occur. They will look like
131 The Ever-Popular 131 domainor
Finally, all of the commandline arguments can have values specified in the configuration file. These values are overridden by the commandline values, but override the default values given in analhead.h. This is useful if you often process the logfile in two different ways; then you can get one of them just by supplying a configuration file without the need to recompile the program or specify a long list of commandline arguments. The legal values for variables are exemplified below.
LOGFILE logfile # the logfile to be analysed DOMAINSFILE domainsfile # where to get the domains from HEADERFILE headerfile # Put this file near the top of the output FOOTERFILE none # But none at the bottom LOGOURL logourl # the URL where the logo for the report title is. LOGO on # or off. Whether to use the logo. HOSTNAME "Stephen's pages" # our organisation HOSTURL http://www.statslab.cam.ac.uk/ # where to find us; - for off. REQFLOOR 1 # if sorting by requests or alphabetically, the # fewest requests needed to get on the request # report; if by bytes, the min traffic in 1/100ths # of a percent; if negative, do a 'top n' report. DIRFLOOR 1 # directory report DOMFLOOR -10 # domain report HOSTFLOOR 100 # if this is too low, host report will be slow and long. REQSORTBY byrequests # how to sort the request report DIRSORTBY alphabetical # directory report DOMSORTBY bybytes # domain report HOSTSORTBY alphabetical # host report. Alphabetical is with # domain as most significant part. MARKCHAR * # the character for graphical displays MARKCHAR '#' # in quotes so that it isn't a comment PAGEWIDTH 65 # the width of the output pages MONTHLY on # do a monthly report? DAILY off # a daily summary? FULLDAILY off # a full daily report (one line for each day)? WEEKLY off # a weekly report? HOURLY on # an hourly summary? DOMAIN on # a domain report? FULLHOSTS off # a full hostname report (can be very long)? DIRECTORY on # a directory report? REQUEST off # a request report? DIRLEVEL 2 # the level of the directory report REQTYPE pages # what to print in the request report; pages or all PAGELINKS on # whether to link to pages in the request report COUNTHOSTS on # count the total number of hosts who have visited? LASTSEVEN on # statistics for the last 7 days? NUMLOOKUP off # try and resolve numerical addresses; NB SLOW! MONTHLYUNIT 1000 # the size of the character in the graphical displays HOURLYUNIT 0 # 0 represents 'choose something sensible automatically' DAILYUNIT 0 FULLDAILYUNIT 0 WEEKLYUNIT 0
make(It may take a while as the program is rater big). If that doesn't work, have a look in the Makefile to see if there's anything that you need to change to suit your configuration, and try again.
The program usage is
analog [logfile | -] [options]The name of the logfile can be omitted, in which case the default (as specified in analhead.h) will be used.
-will use stdin. This is useful for constructing pipes, e.g.,
cat access_log1 access_log2 | analog -(This is safe, because the program works properly even if the logfile it is analysing is not in chronological order).
The legal options are as follows. (Again, you don't need any of these; you can just use the defaults). All of them have default values which can be changed in the analhead.h or the configuration file). If two contradictory options are specified, the latter is heeded (this might be useful if you have an alias set up, for example). Note that items in square brackets are optional; also that there can be no space between an option and any arguments to it. See the pages cited above for the meaning of the various reports.
-m Don't do a monthly report. +m[n] Do a monthly report. Make each character in the graph worth n requests; if n = 0, choose something sensible. -d | +d[n] Don't do/Do a daily summary. -h | +h[n] Don't do/Do an hourly summary. -o Don't do a domain report. +o[a|b|r][n] Do a domain report. Sort alphabetically/by bytes/ by requests. If n is positive, only print domains with at least n requests (r or a) or at least n/100ths of a percent of the traffic (b). If n is negative, print the top n (well, top -n actually) on the report. -i | +i[a|b|r][n] Directory report. -r | +r[a|b|r][n] Request report; report pages only. (But other files are still counted in the other reports). -R | +R[a|b|r][n] Request report; report all filenames. -S | +S[a|b|r][n] Host report; one line for every host. This is slow and produces copious output unless n is set high or only a small (part of a) logfile is being analysed. -s | +s Don't/do count number of distinct hosts. Not doing this can save a lot of memory! +S forces +s. -7 | +7 Don't/do give statistics for last 7 days. -ln Level (or depth) of directory report. -k | +k | +kk Don't link in the request report / link to pages / link to everything. -cchar The character to use in the graphical displays. -wn The width of the page for output. 65 is about right. -nhostname The name of your organisation or WWW server. (Printed in the title of the output page). -uhosturl The URL of your front page. Use -u- if you don't want the top line of your output to be linked to anywhere. -fdomainsfile The domains file you want to use. +gconffile The configuration file you want to use. Use +g- to read configuration instructions from stdin. +Gconffile Use another configuration file in addition to the default one. -g | -G Don't use a configuration file. +Hheaderfile Include the specified header file near the top of the output. -H Don't use a header file. +Ffooterfile Put this file at the bottom of the output. -F Don't use a footer file. -p Don't put a logo at the top (p for picture) +p[logourl] Do put a logo. Find it at the given URL. -1 / +1 Don't / do try and look up all numerical address. (May be slow).
The figures for the last 7 days are for the 7 days before the program is run, not before the last entry in the logfile. Moreover, they are actually for any times after 7 days before the program is started; so `future' requests will be included if some more requests come in while the program is reading the logfile (or if the clock on the computer running the program is not sychronised with the one on the computer that recorded the logs).
If we are doing a `top n' report and two entries tie for nth place, only one will be printed.
The reported `running time' is elapsed real time, not CPU time.
If you specify
+oa-10 you really do get the top ten domains
Subdomains will be reported in the domain report if and only if their parent domain is, independent of their usage.
The program uses a rather naïve method to determine what is a `page'
for the purpose of the request report. A page is anything that ends in
The bytes aren't reported correctly. This is really a bug in the logfile. Servers don't actually measure the number of bytes transferred, they measure the size of the file they are about to transfer, so if a connection is interrupted, they may write down more bytes than were actually transferred.
The following list contains in no particular order things that I think would be good to be able to do with analog, as well as things that people have suggested that I have not yet implemented. I welcome comments on how high a priority people place on the various items, and what other things would be useful. Some of these I want to do anyway, but some definitely won't get done unless other people want them.
(not statslab).cam.ac.uk. (The exact user input could be tricky).
Thanks are also due to all those who helped in the early stages of writing this program. Those who made helpful suggestions during beta testing are numerous, but I must mention particularly Dan Anderson, Martyn Johnson, Joe Ramey, Quentin Stafford-Fraser and Dave Stanworth; and above all Gareth McCaughan for lots of programming advice.
Page last modified: 11-Jul-95