在控制臺分析nginx日志

goaccess -f b.log


生成html文件分析nginx日志

vi ~/.goacce***c

time-format %T

date-format %d/%b/%Y

log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u"

各參數詳解: ?man goaccess

Nginx Variable ? ? ? ? ? ? ? ? ? ? ? ? ? ?GoAccess Variable

$remote_addr ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?%h

$remote_user ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?%^ (ignored)

$time_local ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? %d:%^

$upstream_cache_status ? ? ? ? ? ? ? ? ? ?%^ (ignored)

$request ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?%r

$status ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? %s

$body_bytes_sent ? ? ? ? ? ? ? ? ? ? ? ? ?%b

$http_referer ? ? ? ? ? ? ? ? ? ? ? ? ? ? %R

$http_user_agent ? ? ? ? ? ? ? ? ? ? ? ? ?%u

goaccess -f b.log -p ~/.goacce***c -a > b.html ?#打開瀏覽器訪問

打開網頁會顯示如下幾項:

1

Unique visitors per day - Including spiders ? ?

每天唯一訪客(來自同樣IP、同一日期和同一瀏覽器的請求被認為是是唯一訪問)

2

Requested Files (URLs)

請求的文件(網頁URL)

3

Static Requests

請求的靜態文件(例如,.png文件,.js文件等等)

4

Not Found URLs (404s)

HTTP 404 未找到的響應代碼

5

Visitor Hostnames and IPs

主機地址(客戶端ip地址)

6

Operating Systems

操作系統

7

Browsers

瀏覽器

8

Time Distribution

時間分布

9

Referrers URLs

引薦網址

10

Referring Sites

參考網站

11

Keyphrases from Google's search engine

來自谷歌搜索引擎的前幾位的關鍵字

12

Geo Location

地理位置

13

HTTP Status Codes

HTTP 狀態代碼