您好,登錄后才能下訂單哦!
這篇文章主要為大家展示了“goaccess如何安裝和使用”,內容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領大家一起研究并學習一下“goaccess如何安裝和使用”這篇文章吧。
一、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 錯誤)
Hit totals are based on total requests. This module will display hits, percent,
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(瀏覽器和搜索引擎)
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.
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.
-f – 日志文件名
-b – 開啟流量統計,如果希望加快分析速度不建議使用該參數
-s – 開啟HTTP響應代碼統計
-a – 開啟用戶代理統計
-e – 開啟指定IP地址統計,默認禁用
-p -指定goacces用戶配置文件路徑
F1 幫助菜單
F5 刷新
q 退出當前口窗、菜單、或是當前查看的選項
o 打開當前的選項、菜單
c 改變窗口配色(目前只有兩種 默認和綠色)
SHIFT + TAB 從當前選定模塊向后切換
RIGHT 打開當前選中模塊,查看詳細信息
s 通過日期排序,只會在訪問請求模塊起作用
S 通過點擊次數排序,只會在訪問請求模塊起作用
/ 查看詳細信息的窗口進行搜索
n 通過/進行查找后,查找下個匹配的內容的位置,如果沒有則在窗口底部顯示“search hit BOTTOM”
t 在查看詳細信息窗口,移動指針到最頂部
b 在查看詳細信息窗口,移動指針到最底部
apache - what is? - how in goaccess
%v - vhost - %^ ignore it
%h - host - %h
%l - hyphen - %^ ignore it
%u - user - %^ ignore it
%t - timestamp - [%d:t% %^] ignore the zone from apache log
%r - request - %r
%s - status - %s
%b - size - %b
%{referer}i - request header - %R
%{UAgent}i - user agent - %u
%d date field matching the date_format variable.
%h host (the client IP address, either IPv4 or IPv6) IT網,http://www.it.net.cn
%r The request line from the client. This requires specific delimiters around the request (as single quotes, double quotes, or anything else) to be parsable. If not, we
have to use a combination of special format specifiers as %m %U %H.
%m The request method.
%U The URL path requested (including any query string).
%H The request protocol.
%s The status code that the server sends back to the client. IT網,http://www.it.net.cn
%b The size of the object returned to the client.
%R The “Referrer” HTTP request header.
%u The user-agent HTTP request header. Linux學習,http:// linux.it.net.cn
%D The time taken to serve the request, in microseconds.
%T The time taken to serve the request, in seconds or milliseconds. Note: %D will take priority over %T if both are used.
%^ Ignore this field. Lin
date_format See http://linux.die.net/man/3/strftime
開始日志分析并導出為html文件:
1 | [root@Rootop ~]# goaccess -f /home/wwwlogs/www.rootop.org.log --log-format='%h %^[%d:%^] "%r" %s %b "%R" "%u"' --date-format='%d/%b/%Y' -d -a > test.html |
或者
[root@Rootop ~]# goaccess -f /home/wwwlogs/www.rootop.org.log -d -a -p ~/.goaccessrc > test2.html
#按日期查找時間段 sed -n "/14//Jul//2015:00:00:00/,/15//Jul//2015:15:00:00/"p access.log > time_access.log
#查找504錯誤的頁面和數量 awk '($9 ~ /504/)' time_access.log | awk '{print $7}' | sort | uniq -c | sort -rn > 504.log
#查找訪問最多的20個IP及訪問次數 awk '{print $1}' time_access.log | sort | uniq -c | sort -n -k 1 -r | head -n 20 > top.log
以上是“goaccess如何安裝和使用”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。