利用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
相关推荐
yangliuhbhd 2020-09-24
风之羽翼 2020-09-14
luotuofeile 2020-07-28
Strongding 2020-06-25
xuanwenchao 2020-06-14
昊 2020-06-04
ysmh00 2020-05-14
ErixHao 2020-05-08
数据库之扑朔迷离 2020-05-06
whyname 2020-04-29
daillo 2020-04-20
踩风火轮的乌龟 2020-04-19
hitxueliang 2020-04-18
hithyc 2020-04-17
snowguy 2020-04-10
zengfanpei 2020-03-08
阿亮 2020-01-30