nginx日志查看goaccess安装使用
准备工作:
- Linux CentOs 6.5
- Nginx 1.8
1. 安装前准备
切换到 /usr/local 使用如下指令:
- wget http://tar.goaccess.io/goaccess-1.0.1.tar.gz
- tar -xzvf goaccess-1.0.1.tar.gz
- cd goaccess-1.0.1/
- ./configure --enable-geoip --enable-utf8
- make
- make install
- 开始使用
1.1 下载源文件
使用如下执行:wget http://tar.goaccess.io/goaccess-1.0.1.tar.gz
1.2 解压缩
使用如下执行:tar -xzvf goaccess-1.0.1.tar.gz
1.3 进入目录中
cd goaccess-1.0.1/
1.4 准备编译检查配置
./configure --enable-geoip --enable-utf8 出现以下截图:
1.4.1 安装 GeoIp
执行 yum install GeoIp 出现异常错误信息:No package GeoIp available. 如何操作呢?根据参考网址获得应该使用:yum install GeoIP GeoIP-devel GeoIP-data
1.5 make
1.6 make install
1.7 开始使用
可能需要配置 /usr/local/goaccess-1.0.1/config 目录下 goaccess.conf 三个变量:
-
time-format %H:%M:%S
-
date-format %d/%b/%Y
-
log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u"
- 查看nginx的日志 goaccess -f /var/log/nginx/access.log -a > report.html
- 查看nginx昨日日志 zcat access.log-20160719.gz |goaccess -a >report.html
参考网址:
- http://my.oschina.net/mrco/blog/181737#navbar-header
- https://www.goaccess.io/download#installation
- http://shouce.jb51.net/nginx/OptionalHTTPmodules/GeoIP.html
- http://serverfault.com/questions/372978/installing-geoip-on-centos
- http://www.geekfan.net/7863/
来源:oschina
链接:https://my.oschina.net/u/998893/blog/700785