CentOS上安裝網站日誌即時分析最新工具GoAccess

來源:互聯網
上載者:User

GoAccess是一款開源的網站日誌即時分析工具。GoAccess 的工作方式很容易理解,就是讀取和解析 Apache/Nginx/Lighttpd 的訪問記錄檔 access log,然後以更友好的方式把統計資訊顯示出來。統計的內容包括:訪問概況、動態網頁面請求、靜態頁面請求(片、樣式表、指令碼等)、訪客排名,訪客使用的作業系統,訪客使用的瀏覽器,來路網域名稱,404 錯誤,搜尋爬蟲,搜尋關鍵詞等等。

GoAccess 的效能也不賴,據官方測試,在一台 Intel Xeon CPU @ 2.40ghz CPU, 2GB 記憶體的機器上處理記錄檔的速度是97000行每秒。

Linux 發行版本內建的 GoAccess 一般太老,比如 Ubuntu 12.04 帶的是 0.4.2,Ubuntu 13.10 帶的是 0.5,而最新的 goaccess 版本是 0.7.1. 所以類似不常用的軟體,Linux 發行官方關注也少,為了使用最新的版本,最好採用原始碼安裝的方式。

在 CentOS 6.5 上安裝編譯 GoAccess 時需要的工具和庫:

# yum groupinstall 'Development Tools'# yum install glib2 glib2-devel ncurses-devel

在 Ubuntu 12.04 上安裝編譯 GoAccess 時需要的工具和庫:

$ sudo apt-get install build-essential$ sudo apt-get install libglib2.0-dev libncursesw5-dev

下載 GoAccess 的原始碼、編譯和安裝:

$ wget http://downloads.sourceforge.net/project/goaccess/0.7.1/goaccess-0.7.1.tar.gz$ tar -xzvf goaccess-0.7.1.tar.gz$ cd goaccess-0.7.1/$ ./configure --enable-utf8$ make$ sudo make install

運行 GoAccess,選擇 NCSA Combined Log Format:

$ /usr/local/bin/goaccess -f /var/log/apache2/access.log                  +--------------------------------------------------+                  | Log Format Configuration                         |                  | [SPACE] to toggle - [ENTER] to proceed           |                  |                                                  |                  | [ ] Common Log Format (CLF)                      |                  | [ ] Common Log Format (CLF) with Virtual Host    |                  | [x] NCSA Combined Log Format                     |                  | [ ] NCSA Combined Log Format with Virtual Host   |                  | [ ] W3C                                          |                  | [ ] CloudFront (Download Distribution)           |                  |                                                  |                  | Log Format - [c] to add/edit format              |                  | %h %^[%d:%^] "%r" %s %b "%R" "%u"                |                  |                                                  |                  | Date Format - [d] to add/edit format             |                  | %d/%b/%Y                                         |                  +--------------------------------------------------+

介面如下:






























GoAccess 還可以產生 HTML 格式的報告:

$ /usr/local/bin/goaccess -f /var/log/apache2/access.log -a > report.html

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.