ngxtop是用python開發(fā)的一款監(jiān)控nginx訪問日志的工具,
它可以實(shí)時(shí)動(dòng)態(tài)地查看訪問最多的請求。
centos上安裝ngxtop
yum install python-pip
pip install ngxtop
用ngxtop -h查看其選項(xiàng),其中幾個(gè)選項(xiàng)含義如下:
1)-l 指定訪問日志
2) -f 指定日志格式
3) --no-follow 只處理當(dāng)前已經(jīng)寫入的日志文件,而不是實(shí)時(shí)處理新增的日志
4) -c 指定nginx.conf路徑
5) -n 指定顯示行號(hào)
內(nèi)容描述.
ngxtop具體用法
1) $ ngxtop
如果報(bào)錯(cuò):Error: Access log file or format was not set and nginx config file cannot be detected. Perhaps nginx is not in your PATH?
這是因?yàn)閚gxtop找不到可執(zhí)行文件nginx,解決辦法是
ln -s /usr/local/nginx/sbin/nginx /sbin/nginx
2)$ ngxtop -c /usr/local/nginx/conf/nginx.conf -n 20 //
指定nginx.conf,顯示20行,結(jié)果如圖
3) $ngxtop -c /usr/local/nginx/conf/nginx.conf print request http_user_agent remote_addr //
使用print打印指定變量
4) $ ssh remote tail -f /var/log/apache2/access.log | ngxtop -f common //
分析遠(yuǎn)程機(jī)器的日志
-
python
+關(guān)注
關(guān)注
56文章
4809瀏覽量
85054 -
nginx
+關(guān)注
關(guān)注
0文章
154瀏覽量
12238 -
CentOS
+關(guān)注
關(guān)注
0文章
79瀏覽量
13828
原文標(biāo)題:如何用ngxtop監(jiān)控nginx訪問?
文章出處:【微信號(hào):aming_linux,微信公眾號(hào):阿銘linux】歡迎添加關(guān)注!文章轉(zhuǎn)載請注明出處。
發(fā)布評(píng)論請先 登錄
相關(guān)推薦
評(píng)論