Apache、Nginx 的 Web Log 一般常見會想要分析來源IP、讀取網址、200、404 的比例(與 Google Analytics 重複的就先不列了,Ex: Unique Visitior...) 等等...可以使用 GoAccess 來快速分析。
GoAccess - 圖形化 Web Log 的分析程式
安裝、執行方式 (Debian / Ubuntu Linux)
- 安裝:sudo apt-get instll goaccess # goaccess - log analyzer and interactive viewer for the Apache Webserver
- 執行:goaccess -f /var/log/apache2/access.log # 會出現選單,空白鍵挑選第一個,然後按 ENTER 即可 (即時分析)
- 設定檔:/etc/goaccess.conf
- cat access.log | goaccess > report.html # 想輸出 HTML,需打開設定檔兩個參數,date-format %d/%b/%Y 和 log-format %h %^[%d:%^] "%r" %s %b
- 或 goaccess -f /var/log/access_log > reports.html
GoAccess 簡介
GoAccess 可以產出 HTML、JSON、CSV 的 Report (下述直接連到官網範例)
GoAccess 會分析下述:
- General statistics, bandwidth, etc.
- Time taken to serve the request (useful to track pages that are slowing down your site)
- Metrics for cumulative, average and slowest running requests
- Top visitors
- Requested files & static files
- 404 or Not Found
- Hosts, Reverse DNS, IP Location
- Operating Systems
- Browsers and Spiders
- Referring Sites & URLs
- Keyphrases
- Geo Location - Continent/Country/City
- Visitors Time Distribution
- HTTP Status Codes
- Metrics per
- Virtual Host New
- Ability to output JSON and CSV
- Tailor GoAccess to suit your own color taste/schemes
- Incremental log processing
- Support for large datasets + data persistence
- Support for HTTP/2 & IPv6
- and more...