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
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