Linux安装GoAccess

GoAccess下载地址:https://goaccess.io/download

1、下载、安装GoAccess

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

Q1:在执行第四步./configure时,遇到问题:

configure: error: 
*** Missing development files for the GeoIP library

解决方法:

$ 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

Q2:在执行第四步./configure时,遇到问题:

configure: error: *** Missing development libraries for ncursesw

解决方法:

要使用–enable-utf8,你需要安装ncursesw
a)、如果你的系统是RedHat系列:

yum list|grep ncurses

yum -y install ncurses-devel

yum install ncurses-devel

b)、如果你的系统是Ubuntu或Debian:

apt-cache search ncurses

apt-get install libncurses5-dev

待安装completed!

./configure
make
make install

GoAccess完成安装截图:
完成截图

2、修改nginx服务器的配置文件nginx.conf

location /report.html {
            #指定个人配置的目录
            root html;
            index report.html index.htm;
         }

重新加载配置文件:

../sbin/nginx -s reload

截图

3、执行goaccess命令,在nginx/logs目录下,执行:

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

打开网站,成功运行!
截图
说明:步骤2和3的目的就是设置nginx的report访问路径,然后由goaccess生成report页面,那用户就可以通过指定路径访问report了。

4、后台运行GoAccess

ubuntu系统:
打开 Tmux 并启动 GoAccess

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

一切正常的话 GoAccess 应该开始分析日志文件了,然后显示 “WebSocket server ready to accept new client connections”。
现在按下你 Tmux 的 PREFIX 键(默认是 Ctrl+B),再按 d 从 Tmux 中脱离出来,这样即使 ssh 断开连接了也能保持后台运行,想查错也可以用

$ tmux attach

5、测试

现在用浏览器打开Nginx的访问路径 http://ip:port/report.html 应该就可以看见分析结果了,每秒钟刷新一次数据。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值