概述
goaccess工具能指定數(shù)據(jù)格式進(jìn)行分析,默認(rèn)支持一系列下面的格式
#log-format COMBINED
#log-format VCOMBINED
#log-format COMMON
#log-format VCOMMON
#log-format W3C
#log-format SQUID
#log-format CLOUDFRONT
#log-format CLOUDSTORAGE
#log-format AWSELB
安裝
由于默認(rèn)goaccess版本老,一分析就segment出錯,采用最新的版本,同時安裝ip到區(qū)域的映射數(shù)據(jù)geoip-database。
echo "deb http://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.listwget -O - http://deb.goaccess.io/gnugpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install goaccess
sudo apt-get install geoip-database
配置
$ vim /etc/goaccess.conf
######################################
# Time Format Options (required)
######################################
# Apache/NGINX's log formats below.
#
time-format %H:%M:%S
######################################
# Date Format Options (required)
######################################
# Apache/NGINX's log formats below.
#
date-format %d/%b/%Y
######################################
# Log Format Options (required)
######################################
# NCSA Combined Log Format
#
log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u"
運行
$ goaccess -f access.log
$ goaccess -f access.log > result.html
$ cat access.log | goaccess
Paste_Image.png