My favorites | Sign in
Project Logo
                
Search
for
Updated Aug 29, 2008 by aristus
Labels: Featured, Phase-Deploy
Installing  
How to install & configure wtop / logrep

1) Requirements

wtop requires Python 2.4 or higher to run.

logrep will use the MaxMind GeoIP library if it is installed. This enables the cc (country code) and country fields. They are pretty nifty so we recommend it.

2) Getting wtop

Get the latest version here: http://wtop.googlecode.com/files/wtop-0.6.3.tar.gz

3) Installing on Linux, Unix, BSD, Mac OSX

   $ tar xvfz wtop-0.6.3.tar.gz
   $ cd ./wtop-0.6.3
   $ sudo python setup.py install

4) Installing on Windows

Unpack the tar.gz archive

   C:\wtop-0.6.3> python.exe setup.py install

This will install the wtop and logrep programs to your executable path. See the Cookbook for lots of examples and useful queries, and UsingLogrep for a full explanation of the command-line options.

5) Configuring Apache

Please Note: By default Apache LogFormats do not have the %D (microsecond response time) directive. You must have at least %s, %r, %t and %D in your LogFormat in order to use wtop. You can use logrep without %D, but you will not be able to use the msec field.

Example: before

LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log common

Example: after

LogFormat "%h %l %u %t \"%r\" %>s %b %D" common
CustomLog logs/access_log common

6) wtop.cfg

The configuration file is installed as /etc/wtop.cfg (Unix) or <PYTHON_HOME>\wtop.cfg (Windows). Take a look at it to configure the location of your log files, any URL classes you want, and so forth.

[main]
DEFAULT_OUTPUT_FIELDS=ts,class,ip,msec,uas,url,refdom

LOG_FILE_TYPE=apache
# This  MUST match your Apache LogFormat directive. 
# To use wtop, you MUST have at least %s, %r, %t and %D.
LOG_FORMAT=%h %l %u %t "%r" %>s %B "%{Referer}i" "%{User-Agent}i" %D
LOG_ROOT=/var/log/apache2/
LOG_FILE=access_log

## uncomment these lines for limited, experimental Microsoft IIS support
# LOG_FILE_TYPE=iis
# LOG_FORMAT=w3c-extended
# LOG_ROOT=C:\Windows\System32\logfiles\W3SVC1\

[wtop]
# max time before a request is logged in the "slow" column
MAX_REQUEST_TIME=5000
# minimum requests/second before a URL class appears in top mode
MIN_RPS=0.2

[classes]
# you can define any classes you wish with regular expressions
#foo=/some/.+/bar
#baz=/some/other/path
#affiliate=MY_AFFILIATE_ID
home=^/(?:\?.*)?$
#static=\.(?:png|gif|jpe?g|cur|ico|bmp|xml|txt|js|css|swf)(?:\?.*)?$
xml=\.xml(?:\?.*)?$
js=\.js(?:\?.*)?$
css=\.css(?:\?.*)?$
swf=\.swf(?:\?.*)?$
img=\.(?:png|gif|jpe?g|cur|ico|bmp)(?:\?.*)?$


[patterns]
# the generic class pattern is used if a URL does not match any 
# of the named classes above.
generic=^/([^/\?]+)   # top-level directory

Sign in to add a comment
Hosted by Google Code