使用GoAccess構建簡單實時日誌分析系統

很早就知道Nginx日誌分析工具GoAccess,但以前因爲只能靜態分析,感受不太強大。最近發現它可以實時顯示報表並且報表也比以前強大不少能作趨勢分析。所以果斷下載安裝。如下是基於CentOS的安裝配置步驟。html


一、安裝 GeoIP
sudo yum install geoip geoip-develnginx

二、安裝
centos: yum install go access
或源碼安裝
$ wget http://tar.goaccess.io/goaccess-1.1.1.tar.gz $ tar -xzvf goaccess-1.1.1.tar.gz $ cd goaccess-1.1.1/ $ ./configure --enable-geoip --enable-utf8 $ make # make installvim

三、配置時間和日誌格式
sudo vim /usr/local/etc/goaccess.conf
將如下項目的註釋去掉
1. Apache/nginx time format time-format %H:%M:%S
2. Apache/nginx date format date-format %d/%b/%Y
3. NCSA Comobined log format log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u」centos

4.運行以下命令實時分析
goaccess -f /home/wwwlogs/access.log -o <output_path>/state.html --real-time-html --date-spec=hr --hour-spec=min --ws-url=www.cbcye.com工具

效果預覽url

相關文章
相關標籤/搜索