goaccess is a free (GPL) real-time web log analyzer and interactive viewer that runs
in a terminal in *nix systems.It provides fast and valuable HTTP statistics for system
administrators that require a visual server report on the fly.GoAccess parses the
specified web log file and outputs the data to the X terminal.
是一個用來統計 Apache Web 伺服器的通路日志的工具,速度非常快,可即時生成統計報表.
一、Debian下安裝goaccess
cat /etc/debian_version
6.0.10
apt-cache search goaccess
goaccess - log analyzer and interactive viewer for the Apache Webserver
apt-get -y install goaccess
二、Centos下安裝goaccess
cat /etc/redhat-release
CentOS release 6.6 (Final)
yum list|grep goaccess
goaccess.x86_64 0.8.5-1.el6 epel
yum -y install goaccess
沒有epel源的話需要安裝
rpm -Uvh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
三、參數說明
-b Enable total bandwidth consumption. To achieve faster parsing,
do not enable this flag. This has been disabled by default.(流量統計)
-f input-file path to input log filename(日志檔案名)
-s Enable/report HTTP status codes. To avoid overhead while parsing,
this has been disabled by default.(HTTP響應代碼統計)
-e Exclude an IP from being count it under the HOST module.
This has been disabled by default.(指定IP位址統計,預設禁用)
-c Prompt log/date configuration window.(配置)
-a Enable a List of User-Agents by host.(使用者代理統計)
四、功能說明
1、General Statistics(統計概況,流量消耗)
Number of valid requests, number of invalid requests, time to analyze the data,
unique visitors, unique requested files, unique static files (css, ico, jpg,
js, swf, gif, png) unique HTTP referrers (URLs), unique 404s (not found),
size of the parsed log file, bandwidth consumption.
2、Unique visitors(訪客排名)
HTTP requests having the same IP, same date and same agent will be considered a
unique visit. This includes crawlers.
3、Requested files(動态Web請求)
Hit totals are based on total requests. This module will display hits, percent,
bandwidth [time served], [protocol] and [method].
4、Requested static files(靜态web請求,如圖檔、樣式表、腳本等)
Hit totals are based on total requests. Includes files such as: jpg, css, swf, js,
gif, png etc.
This module will display hits,percent,bandwidth,[time served],[protocol] and [method].
5、404 or Not Found(404 錯誤)
bandwidth, [time served], [protocol] and [method].
6、Operating Systems(作業系統)
Hit totals are based on unique visitors. This module will display hits and percent.
The expanded module shows all available versions of the parent node.
7、Browsers(浏覽器和搜尋引擎)
8、HTTP Status Codes(HTTP 響應代碼)
The values of the numeric status code to HTTP requests.
Hit totals are based on total requests. This module will display hits and percent.
9、Keyphrases(鍵盤布局)
This module will report keyphrases used on Google search, Google cache,
and Google translate. Hit totals are based on total requests. This module will dis-
play hits and percent.
五、官網
http://www.goaccess.io/
六、這裡是在debian5.0.1上編譯安裝goaccess
1、下載下傳
wget http://tar.goaccess.io/goaccess-0.9.tar.gz
或axel -n 5 http://tar.goaccess.io/goaccess-0.9.tar.gz
2、解壓
tar -xzvf goaccess-0.9.tar.gz
3、configure
cd goaccess-0.9/
./configure --prefix=/opt/goaccess
4、編譯并安裝
make && make install
5、直接使用指令
cd /opt/goaccess/bin/
cp goaccess /usr/local/sbin/
PS:我這邊将goaccess安裝在/opt/goaccess目錄下了。
七、指令行下如何使用
goaccess -f /var/log/apache2/aaa.access.log(當然其他nginx日志也可以的)
這個時候會彈出配置視窗:
<a href="http://s3.51cto.com/wyfs02/M00/6D/0F/wKioL1Vb342AaguOAAHmEUnLV1o071.jpg" target="_blank"></a>
我這邊選NCSA Combined Log Format
之後按enter就可以了
因為每次打開都會彈出這個配置視窗,可以修改以下配置檔案
cat /opt/goaccess/etc/goaccess.conf |egrep -v "^#|^$"
time-format %H:%M:%S
date-format %d/%b/%Y
log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u"
再次執行的時候就不會彈出配置視窗了
也可以通過分析指定某1天的日志
grep '17/Apr/2015' aaa_access.log|goaccess
八、網頁形式展示
未完待續
本文轉自 xdoujiang 51CTO部落格,原文連結:http://blog.51cto.com/7938217/1651862,如需轉載請自行聯系原作者