Mirror site is read only www.netnr.com
netnr 2021-07-15 11:31:38 2021-07-28 14:15:40 👁420 💬0

在 CentOS 7 上安装 GoAccess

yum install epel-release # 安装 Epel
yum repolist # 更新
yum install ncurses-devel gcc # 安装依赖项
yum install geoip-devel tokyocabinet-devel

开始安装 GoAccess 最新版本:https://goaccess.io/download

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

创建软链接

ln -s /usr/local/bin/goaccess /usr/bin/goaccess 

Nginx 日志配置转 GoAccess

https://github.com/stockrt/nginx2goaccess

# 使用
./nginx2goaccess.sh '<log_format>'

# 输出,写入配置文件 goaccess.conf
time-format %T
date-format %d/%b/%Y
log_format %h - %^ [%d:%t %^] "%r" %s %b "%R" "%u"

使用

goaccess access.log
goaccess access.log access.log.1 # 多个日志文件
goaccess access.log -a > access.html # 生成 HTML
goaccess access.log -a -d -o json > access.json # 生成 JSON
goaccess access.log --no-csv-summary -o csv > access.csv # 生成 CSV

链接