使用GoAccess对nginx日志的在线监控

有人用centos,有人用ubuntu,centos文章很多,此文针对ubuntu
 

安装依赖库GeoIP

wget https://github.com/maxmind/geoip-api-c/releases/download/v1.6.11/GeoIP-1.6.11.tar.gz
tar -xzvf GeoIP-1.6.11.tar.gz

cd GeoIP-1.6.11/

./configure

make

make install

 使用--enable-utf8,需要安装ncursesw
sudo apt-get install libncursesw5-dev

安装GoAccess

 wget https://tar.goaccess.io/goaccess-1.4.tar.gz
 tar -xzvf goaccess-1.4.tar.gz
 cd goaccess-1.4/
 ./configure --enable-utf8 --enable-geoip=legacy
 make
 make install

步骤拆分
1.ubuntu安装GoAccess

GoAccess下载地址:GoAccess - Downloads
ubuntu 不支持yum wget先下载解压GoAccess 

 wget https://tar.goaccess.io/goaccess-1.4.tar.gz

 tar -xzvf goaccess-1.4.tar.gz

进入到目录

cd goaccess-1.4/

安装过程会报错  你可先解决错误后再安装 避免错误出现
安装

 ./configure --enable-utf8 --enable-geoip=legacy
 make
 make install

安装过程会出现一下两个错误:
错误1:
configure: error: 
*** Missing development files for the GeoIP library

解决办法 安装依赖GeoIP
下载解压
可以到github下载 https://developer.aliyun.com/packageSearch?word=GeoIPTags · maxmind/geoip-api-c · GitHubhttps://developer.aliyun.com/packageSearch?word=GeoIP

 wget https://github.com/maxmind/geoip-api-c/releases/download/v1.6.11/GeoIP-1.6.11.tar.gz
 tar -xzvf GeoIP-1.6.11.tar.gz

cd进入 GeoIP

 cd GeoIP-1.6.11/

安装依赖库GeoIP

 ./configure
 make
 make install

错误二:
configure: error:
*** Missing development libraries for ncursesw

解决办法 使用--enable-utf8,需要安装ncursesw

安装ncursesw
使用命令apt-get安装

sudo apt-get install libncursesw5-dev

安装步骤拆分结束

GoAccess安装完成后
进入到ngin日志文件logs

cd /usr/local/nginx/logs/

 

  • 启动goaccess,对goaccess.log 进行监控

    goaccess access.log -c

    选择第一项 回车空格    回车进入日志分析
     

  • 对日志进行分析

     

  • 日志生成html

    goaccess access.log -o ../html/report.html --log-format=COMBINED --real-time-html --time-format='%H:%M:%S'  --date-format='%d/%b/%Y' 

    日志分析完成后浏览器访问页面
    本地nginx80端口映射了html路径  所以直接访问http://ip/report.html

     

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值