概述
goaccess工具能指定数据格式进行分析,默认支持一系列下面的格式
#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
安装
由于默认goaccess版本老,一分析就segment出错,采用最新的版本,同时安装ip到区域的映射数据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
网友评论