网站日志分析工具goaccess安装配置实战

1
2
3
4
yum install glib2 glib2-devel GeoIP-devel  ncurses-devel zlib zlib-devel
yum install gcc -y
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
yum -y install GeoIP-update
1
2
3
wget https://tar.goaccess.io/goaccess-1.3.tar.gz
tar xzvf goaccess-1.3.tar.gz
cd goaccess-1.3/ ; ./configure --enable-geoip --enable-utf8 ; make && make install
1
2
3
log_format  main  '$remote_addr - $remote_user [$time_local] requesthost:"$http_host"; "$request" requesttime:"$request_time"; '
        '$status $body_bytes_sent "$http_referer" - $request_body'                      
        '"$http_user_agent" "$http_x_forwarded_for"';
1
2
3
location /report.html {
            alias /home/zopen/nginx/html/report.html;    #指定个人配置的目录
        }

修改文件/usr/local/etc/goaccess.conf改成goaccess格式标准对应为

1
2
3
time-format %T
date-format %d/%b/%Y
log-format %h - %^ [%d:%t %^] requesthost:"%v"; "%r" requesttime:"%T"; %s %b "%R" - %^"%u"
1
goaccess access.log -o ../html/report.html --real-time-html --time-format='%H:%M:%S'  --date-format='%d/%b/%Y' --log-format=COMBINED
1
/usr/local/bin/goaccess /var/log/nginx/access.log -o /usr/share/nginx/html/go.html  --real-time-html &

configure: error:
*** Missing development files for the GeoIP library

解决方法:

1
2
3
4
5
6
$ wget https://github.com/maxmind/geoip-api-c/releases/download/v1.6.11/GeoIP-1.6.11.tar.gz
$ tar -xzvf GeoIP-1.6.11.tar.gz
$ cd GeoIP-1.6.11
$ ./configure
$ make
 make install

configure: error: *** Missing development libraries for ncursesw

解决方法:

要使用–enable-utf8,你需要安装ncursesw,下面是安装命令:

1
yum install ncurses-devel 

随机文章