ngxtop是用python開發(fā)的一款監(jiān)控nginx訪問日志的工具,
它可以實時動態(tài)地查看訪問最多的請求。
centos上安裝ngxtop
yum install python-pip
pip install ngxtop
用ngxtop -h查看其選項,其中幾個選項含義如下:
1)-l 指定訪問日志
2) -f 指定日志格式
3) --no-follow 只處理當(dāng)前已經(jīng)寫入的日志文件,而不是實時處理新增的日志
4) -c 指定nginx.conf路徑
5) -n 指定顯示行號
內(nèi)容描述.
ngxtop具體用法
1) $ ngxtop
如果報錯:Error: Access log file or format was not set and nginx config file cannot be detected. Perhaps nginx is not in your PATH?
這是因為ngxtop找不到可執(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文章
4822瀏覽量
85931 -
nginx
+關(guān)注
關(guān)注
0文章
163瀏覽量
12459 -
CentOS
+關(guān)注
關(guān)注
0文章
83瀏覽量
14120
原文標(biāo)題:如何用ngxtop監(jiān)控nginx訪問?
文章出處:【微信號:aming_linux,微信公眾號:阿銘linux】歡迎添加關(guān)注!文章轉(zhuǎn)載請注明出處。
發(fā)布評論請先 登錄
主要學(xué)習(xí)下nginx的安裝配置
[Ganglia監(jiān)控擴(kuò)展]監(jiān)控nginx的連接數(shù)
![[Ganglia<b class='flag-5'>監(jiān)控</b>擴(kuò)展]<b class='flag-5'>監(jiān)控</b><b class='flag-5'>nginx</b>的連接數(shù)](https://file.elecfans.com/web2/M00/49/AA/pYYBAGKhvEuAeEvMAABL0z-VcIs478.png)
TensorRT的Python API的基本用法和接口解析
Nginx如何和現(xiàn)有監(jiān)控系統(tǒng)集成
如何安裝Python解釋器
搭建Keepalived+Lvs+Nginx高可用集群負(fù)載均衡

評論