日志分析工具GoAccess

简介

GoAccess is an open source real-time web log analyzer and interactive viewer that runs in a terminal in linux/unix systems. It provides fast and valuable HTTP statistics for system administrators that require a visual server report on the fly.

安装

编译安装

1
2
3
4
5
6
$ wget http://tar.goaccess.io/goaccess-0.9.8.tar.gz
$ tar -xzvf goaccess-0.9.8.tar.gz
$ cd goaccess-0.9.8/
$ ./configure --enable-geoip --enable-utf8
$ make
# make install

Fedora/CentOS

1
# yum install goaccess

Debian/Ubuntu

1
# apt-get install goaccess

OS X / Homebrew

1
# brew install goaccess

依赖

Distro NCurses GeoIP (optional) Tokyo Cabinet (optional)
Ubuntu/Debian libncursesw5-dev libgeoip-dev libtokyocabinet-dev
Fedora/RHEL/CentOS ncurses-devel geoip-devel tokyocabinet-devel
Arch Linux ncurses geoip compile from source
Gentoo sys-libs/ncurses dev-libs/geoip dev-db/tokyocabinet
Slackware ncurses GeoIP tokyocabinet

输出

To output to a terminal and generate an interactive report:

1
# goaccess -f access.log

To generate an HTML report:

1
# goaccess -f access.log -a > report.html

To generate a JSON report:

1
# goaccess -f access.log -a -d -o json > report.json

To generate a CSV file:

1
# goaccess -f access.log --no-csv-summary -o csv > report.csv

日志格式配置

1
2
3
4
5
6
vi /usr/local/Cellar/goaccess/0.9.7/etc/goaccess.conf(mac)
vi /usr/local/etc/goaccess.conf(linux)
# 配置以下参数的格式:
time-format %H:%M:%S
date-format %d/%b/%Y
log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u"
八宝粥 wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!