安装GoAccess

官网:https://goaccess.io

1、安装epel源

yum -y install epel-release

2、安装依赖:

yum -y install glib2 glib2-devel ncurses ncurses-devel GeoIP GeoIP-devel

3、安装goaccess

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

4、查看版本号

goaccess  -V

ps: 注意PATH变量有没有包含/usr/local/bin

5、使用:

goaccess  /usr/local/nginx/logs/access.log   #你的nginx日志路径

第一个,空格,回车

goaccess-1.png

goaccess-2.png

开放到浏览器来访问:
如你的index.html 是在: /usr/local/nginx/html/openlocal

生产环境:

        location /ruireport {
            allow 你的IP;
            deny all;
            index  report.html;
            alias  /usr/local/nginx/html/ruireport/;
        }

则使用命令生成报表:

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

如果系统语言是英文的,则运行下面的命令:

LANG="zh_CN.UTF-8" bash -c "goaccess /usr/local/nginx/logs/access.log -o /usr/local/nginx/html/irisreport/report.html --real-time-html --time-format='%H:%M:%S' --date-format='%d/%b/%Y' --log-format=COMBINED"

6、浏览器直接访问:

http://192.168.15.236/report.html

goaccess-3.png


转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。

文章标题:安装GoAccess

本文作者:wangzhirui

发布时间:2021-02-20, 15:09:00

最后更新:2025-02-27, 02:04:04

原始链接:https://wangzhirui.com/2021/02/20/安装GoAccess/

转载请保留原文链接及作者。

目录