LIVE DEMO:https://rt.goaccess.io/
安裝方式: https://goaccess.io/download#installation
代碼: 選擇全部
$ 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
安裝若有 geoip 問題, 可以先安裝好 geoip 套件與 geoip-devel 套件.
完成後, 預設即可分析 nginx 與 apache log, 指令如下:
文字輸出:
代碼: 選擇全部
goaccess access.log -c
代碼: 選擇全部
goaccess access.log -o report.html --log-format=COMBINED
代碼: 選擇全部
goaccess access.log -o /var/www/html/report.html --log-format=COMBINED --real-time-html
若有 ssl 憑證, 可以用:
代碼: 選擇全部
--ssl-cert=[crt file] --ssl-key=[key file]
多重 log 檔案, 若為壓縮態的 gz 可以用 zcat
代碼: 選擇全部
zcat access.log-*.gz | goaccess -o report.html --log-format=COMBINED
若是 iis format log, 可以用這個 script goiisformat.sh預處理 format: https://gist.github.com/soheilpro/a34957550b1bd7d42be2
而 goaccess 指令可用:
代碼: 選擇全部
goaccess -f u_ex150629.log --log-format "$(cat u_ex150629.log | ./goiisformat.sh)" --date-format '%Y-%m-%d' --time-format '%H:%M:%S'