2016년 6월 16일 목요일

goaccess installation

syslog나 weblog들을 집계/분석/디스플레이 해 줄 수 있는 툴
https://goaccess.io

[설치]

GeoIP 모듈 설치
curl -sL https://github.com/maxmind/geoip-api-c/releases/download/v1.6.9/GeoIP-1.6.9.tar.gz | tar xz
./configure --prefix=/usr/local
make && make install

GeoIP Database 설치
wget -N http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gunzip GeoIP.dat.gz
mkdir /usr/local/share/GeoIP
mv GeoIP.dat /usr/local/share/GeoIP/

Ncurses 모듈 설치
sudo yum install ncurses-devel

GoAccess 설치
wget http://tar.goaccess.io/goaccess-1.0.tar.gz
./configure --enable-geoip --enable-utf8 --prefix=/usr/local

실행 명령어
goaccess -f access_log.log -o report.html --real-time-html --ws-url=localhost

알아야할 점
report.html은 web server 로 serving 해야 함. report.html 내부에 goaccess에서 띄워놓은 websocket과 통신하는 로직이 담겨 있음.

ngnix 설정 예
location /goaccess 
{
  alias   /usr/local/nginx/html;
  index   report.html;
}