nginx???????????(ngxtop)
???????????? ???????[ 2014/7/22 14:19:36 ] ????????nginx ???????
????ngxtop??????nginx?????????????????????????????????????????????top????????????????ngxtop??????ngxtop???????????????nginx??????????????????tail???????????? 1. ???ngxtop 1.1 ????
????# wget https://github.com/lebinh/ngxtop/archive/master.zip -O ngxtop-master.zip
????# unzip ngxtop-master.zip
????# cd ngxtop-master
????# python setup.py install
????...???....
????Finished processing dependencies for ngxtop==0.0.1
????//??????????????????????????????????????? 1.2 ngxtop???
????pip install ngxtop
????2. ngxtop??????
????# ngxtop --help
????ngxtop - ad-hoc query for nginx access log.
????Usage:
????ngxtop [options]
????ngxtop [options] (print|top|avg|sum) ...
????ngxtop info
????ngxtop [options] query ...
????Options:
????-l ?? --access-log ???????????????
????-f ?? --log-format log_format?????????????? [???: combined]
????--no-follow ngxtop default behavior is to ignore current lines in log
????and only watch for new lines as they are written to the access log.
????Use this flag to tell ngxtop to process the current content of the access log instead.
????-t ?? --interval report interval when running in follow mode [default: 2.0]
????-g ?? --group-by ??????????? [???: request_path]
????-w ?? --having having clause [default: 1]
????-o ?? --order-by ???? [???: count]
????-n ?? --limit ????????? [default: 10]
????-a ...?? --a ... add exp (must be aggregation exp: sum?? avg?? min?? max?? etc.) into output
????-v?? --verbose ????????
????-d?? --debug print every line and parsed record
????-h?? --help ??????????.
????--version ????汾???.
??????????:
????-c ?? --config ????ngxtop????nginx???????
????-i ?? --filter filter in?? records satisfied given expression are processed.
????-p ?? --pre-filter in-filter expression to check in pre-parsing phase.
????????:
????All examples read nginx config file for access log location and format.
????If you want to specify the access log file and / or log format?? use the -f and -a options.
????"top" like view of nginx requests
????$ ngxtop
????404????????
????$ ngxtop top request_path --filter 'status == 404'
??????????????????
????$ ngxtop --order-by 'avg(bytes_sent) * count'
??????????????ip???
????$ ngxtop --group-by remote_addr
???????400???????????????????????
????$ ngxtop -i 'status >= 400' print request status http_referer
????Average body bytes sent of 200 responses of requested path begin with 'foo':
????$ ngxtop avg bytes_sent --filter 'status == 200 and request_path.startswith("foo")'
???????common??????????????????Apache???????
????$ ssh remote tail -f /var/log/apache2/access.log | ngxtop -f common
????3. ngxtop??? 3.1 ????
????# ngxtop -c /usr/local/nginx-1.5.2/conf/nginx.conf
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11