在Centos中使用goaccess查看Nginx日志

在Nginx的配置文件中配置一下access日志:

 log_format access ‘$remote_addr – $remote_user [$time_local] “$request” ‘‘$status $body_bytes_sent “$http_referer” ‘‘”$http_user_agent” $http_x_forwarded_for’;
 access_log  /usr/local/openresty/nginx/logs/access.log;

 

安装一下goaccess:

yum -y install glib2 glib2-devel ncurses ncurses-devel geoip geoip-devel

cd /usr/local
wget http://tar.goaccess.io/goaccess-0.9.2.tar.gz
tar zxvf goaccess-0.9.2.tar.gz
cd goaccess-0.9.2
./configure --enable-geoip --enable-utf8
make && make install
make clean


3. GoAccess 使用方法
进入 Nginx 日志所在目录

命令行直接查看
cd /usr/local/openresty/nginx/logs

goaccess -f access.log

出来图了,日志格式选 NCSA

http://www.fancycoding.com/log-analyse-using-goaccess/

禁止IP访问:
iptables -I INPUT -s 222.35.67.155 -j DROP
恢复IP访问:
iptables -D INPUT -s 222.35.67.155 -j DROP

 

查看网卡:

nload -m eth1

 

posted @ 2015-07-08 14:31  糖豆爸爸  阅读(1150)  评论(0编辑  收藏  举报
Live2D