我們經(jīng)常會(huì)需要知道服務(wù)器的實(shí)時(shí)監(jiān)測(cè)服務(wù)器的運(yùn)行狀況,比如哪些 URL 的訪問(wèn)量最大,服務(wù)器每秒的請(qǐng)求數(shù),哪個(gè)搜索引擎正在抓取我們網(wǎng)站?面對(duì)這些問(wèn)題,我們雖然可以去分析查看統(tǒng)計(jì)訪問(wèn)日志文件,但是卻不能讓我們實(shí)時(shí)統(tǒng)計(jì),不能給我們直觀的統(tǒng)計(jì)數(shù)據(jù)。現(xiàn)在好了,apachetop這個(gè)工具就可以實(shí)時(shí)的跟蹤log的變化,能查看訪問(wèn)者正在查看哪些文件,和訪問(wèn)者IP等信息。
1. apachetop安裝
代碼如下:
# rpm -ivh http://mirrors.hustunique.com/epel/5/i386/epel-release-5-4.noarch.rpm
# yum install apachetop
2. apapchetop使用
代碼如下:
# 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 保持請(qǐng)求字符串 [no]
-l 所有的url小寫 [no]
-s num 保持url路徑段數(shù)量 [all]
-p 在referrer前面保留協(xié)議 [no]
-r 保留每一個(gè)的主機(jī)/ip [no]
Stats options:
必須提供兩個(gè)參數(shù) . default: [-T 30]
-H hits 保持狀態(tài)只到多少點(diǎn)擊數(shù)
-T secs 保持狀態(tài)只到多少秒
-d secs 刷新延遲時(shí)間 [5]
-h this help
當(dāng)執(zhí)行之后,還有命令可以切換顯示狀態(tài):
代碼如下:
ONE-TOUCH COMMANDS
d : 切換urls/referrers/hosts顯示模式開(kāi)關(guān)
n : 切換hits & bytes或返回代碼開(kāi)關(guān)
h or ? : 幫助信息
p : (un)暫停顯示 (凍結(jié)更新)
q : 退出 ApacheTop
up/down : 移動(dòng)星標(biāo) up/down
right/left : 進(jìn)入/退出逐條顯示模式
子菜單:
s: 排序: [the appropriate menu will appear for your display]
r) requests R) reqs/sec b) bytes B) bytes/sec
2) 2xx 3) 3xx 4) 4xx 5) 5xx
t: 固定顯示 ON/OFF:
u) urls r) referrers h) hosts
f: 使用過(guò)濾器:
a) add/edit menu c) clear all s) show active (not done yet)
新聞熱點(diǎn)
疑難解答
圖片精選