利用goaccess来分析nginx 中access日志
1 下载goaccss包
wget http://tar.goaccess.io/goaccess-1.2.tar.gz ------------------------------- tar -zxvf goaccess-1.2 --------------------- cd goaccess-1.2 ----------------------- ./configure --prefix=/usr/local/goaccess --enable-geoip --enable-utf8 -------------------------- make && make install 如果./configure 报错了,一般是缺乏相应的依赖库,都安装就行了
2,在/usr/local/goaccess/bin 目录下创建文件goaccessrc
time-format %T date-format %d/%b/%Y log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u"
3,两种方式查看报告
一种是直接生成,下载下来读取
/usr/local/goaccess/bin/goaccess -f /usr/local/nginx/logs/access.log -p /usr/local/goaccess/bin/goaccessrc -a > report.html
一种是实时读取:
/usr/local/goaccess/bin/goaccess -f /home/app_user_5i5j/nginx/logs/access.log -p /usr/local/goaccess/bin/goaccessrc -o ../html/report.html --real-time-html
然后在nginx.conf中加一个location
location /report.html{ alias /usr/local/nginx/html/report.html; }
这样就可以直接访问了。
另外:日志分析页面是英文,还是可以看的懂的
如果报错:
configure: error: *** Missing development libraries for ncursesw
执行下面两个命令即可
yum install ncurses-libs
yum install ncurses-devel
相关推荐
houjinkai 2019-12-14
Mapleabao 2019-08-15
Wenjing 2017-07-18
单调的低调 2015-07-24
SZStudy 2018-11-08
huzilinitachi 2019-06-28
jianxing 2019-06-20
ccschan 2018-09-04
HatsuneMiku 2017-09-28
FightingBoy 2016-12-23
pittpakk 2016-07-27
Movenow 2014-06-17
MY进修之路 2014-06-17