We often need to know the server's real-time monitoring of the health of the server, such as which URLs are the largest number of visits, the server per second requests, which search engine is crawling our site? Faced with these problems, although we can go to the analysis of the statistical access log files, but it can not let us real-time statistics, can not give us intuitive statistical data. Now, apachetop This tool will be able to track log changes in real time, to see which files visitors are looking at, and what information they have on their visitors ' IP.
1. Apachetop Installation
# RPM-IVH http://mirrors.hustunique.com/epel/5/i386/epel-release-5-4.noarch.rpm
# yum Install Apachetop.
2. Apapchetop Use
# apachetop-h
Apachetop V0.12.6-usage:
File options:
-F LogFile Open logfile (assumed common/combined) [/var/log/httpd/access_log]
(repeat option for more than one source)
Url/host/referrer munging Options:
-Q Keep Request string [No]
-L All URLs lowercase [no]
-s num Keep URL path segment quantity [all]
-P preserves the protocol before referrer [No]
-R retains each host/IP [no]
Stats options:
Two parameters must be supplied. Default: [-T 30]
-h hits keep state only to how many clicks
-T secs hold state only to how many seconds
-D secs Refresh delay time [5]
-H This Help
When executed, there are also commands to toggle the display status:
One-touch COMMANDS
D: Toggle urls/referrers/hosts display Mode switch
N: Toggle hits & bytes or return code switch
H or? : Help Information
P: (un) pause display (freeze update)
Q: Exit Apachetop
Up/down: Moving the star sign Up/down
Right/left: Enter/exit display mode
Sub Menu:
S: Sort: [The appropriate menu would appear for your display]
R) Requests r) reqs/sec B bytes b) bytes/sec
2) 2xx 3) 3xx 4) 4xx 5) 5xx
T: Fixed display On/off:
u) (URL R) referrers h) hosts
F: Use filters:
A) Add/edit menu C) Clear all S show active (not done yet)
A:add FILTER Submenu
u) to URL R to referrers h) to hosts
3. apachetop Example
Apache
Apachetop can also monitor nginx logs in real time, but the Nginx access log format must be either generic or federated log format, otherwise some information is not statistically available.