Phân tích log apache và theo dõi tình trạng Server
Wtop là ứng dụng khá hiệu quả cho các nhà quản trị web server, với wtop ta có thể phân tích log của apache và theo dõi tình trạng của web server. Wtop giống như lệnh top nhưng wtop dùng chuyên biệt cho web server.

Cài đặt Wtop
# cd /tmp
# wget http://wtop.googlecode.com/files/wtop-0.5.6.tar.gz
# tar -zxvf wtop-0.5.6.tar.gz
# cd wtop-0.5.6
# python setup.py install
Cấu hình wtop
Để bắt đầu sử dụng wtop lần đầu tiên ta phải cấu hình file /etc/wtop.cfg để thiết lập các thông số và log file.
# vi /etc/wtop.cfg
Ví dụ file cầu hình /etc/wtop.cfg
[main]
LOG_ROOT=/var/log/lighttpd/cyberciti.biz/
LOG_FILE=access.log
DEFAULT_OUTPUT_FIELDS=ts,class,ipcnt,ip,msec,uas,url
# This must match your webserver log format. You MUST have at least %h, %r and %D
LOG_FORMAT=%h %l %u %t “%r” %>s %B “%{Referer}i” “%{User-Agent}i” %D
[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 extend these to make any classes you wish
home=^/(?:\?.*)?$
xml=\.xml(?:\?.*)?$
js=\.js(?:\?.*)?$
css=\.css(?:\?.*)?$
img=\.(?:png|gif|jpe?g|cur|ico|bmp)(?:\?.*)?$
[patterns]
# the generic pattern is applied if a line does not match any
# of the named classes. By default it uses the top-level directory.
generic=^/([^/\?]+)
# incomplete list of known web robots
robots = r’(?:nutch|MSRBOT|translate.google.com|Feedster|Nutch|Gaisbot|Snapbot|VisBot|libwww|CazoodleBot|polybot|VadixBot|Sogou|SBider|BecomeBot|Yandex|Pagebull|chudo|Pockey|nicebot|entireweb|FeedwhipBOT|ConveraCrawler|NG/2.0|WebImages|Factbot|information-online|gsa-crawler|Jyxobot|SentinelCrawler|BlogPulseLive|YahooFeedSeeker|GurujiBot|wwwster|Y\!J-SRD|Findexa|SurveyBot|yetibot|discoveryengine|fastsearch|noxtrum|Googlebot|Snapbot|OGSearchSpider|heritrix|nutch-agent|Slurp|msnbot|cuill|Mediapartners|YahooSeeker|GrabPERF|keywen|ia_archiver|crawler.archive.org|Baiduspider|larbin|shopwiki)’
Để sử dụng ta dùng lệnh
# wtop
Một số ví dụ sữ dụng loggrep để theo dõi tình trạng web server
# logrep -m top -h access.log
# logrep -m grep -g MSNBot -i home -o status,msec,url access.log
# logrep -m tail --f 'url~wordpress|themes,ref~google.com' access.log