最佳 Nginx 日志分析工具 GoAccess - Best Nginx log analyzer

非常小又精悍的 Nginx 日志分析工具 GoAccess,今天在 CentOS VPS 上安装测试了一番

就2个字,神器!

可以用 XShell 或 Putty 上去命令查看,也可以生成 html 报告,先看图

原文作者:21Andy.com

Main scrollable dashboard
最佳 Nginx 日志分析工具 GoAccess   Best Nginx log analyzer a0266da1ac649a3a

Operating Systems module/report
最佳 Nginx 日志分析工具 GoAccess   Best Nginx log analyzer 3a966303ef6baaf7

Browsers module/report. All reports are searchable
最佳 Nginx 日志分析工具 GoAccess   Best Nginx log analyzer 4a9096e679782f92

Main scrollable window/report
最佳 Nginx 日志分析工具 GoAccess   Best Nginx log analyzer 9a8e462964e4da52

Hosts module/report - Reverse DNS & IP Geolocation
最佳 Nginx 日志分析工具 GoAccess   Best Nginx log analyzer 39ca1719fc1c0c9c

Full HTML report
最佳 Nginx 日志分析工具 GoAccess   Best Nginx log analyzer 639a4ff93e05e519

下面记录一下 GoAccess 在 CentOS 上的安装方法:
1. 需要安装 GeoIP, ncurses, glib2, 一句搞定
#yum -y install glib2 glib2-devel ncurses ncurses-devel GeoIP GeoIP-devel

2. 下载 GoAccess 解压编译安装

# wget http://downloads.sourceforge.net/project/goaccess/0.5/goaccess-0.5.tar.gz
# tar zxvf goaccess-0.5.tar.gz
# cd goaccess-0.5
# ./configure --enable-geoip --enable-utf8
# make && make install
# make clean

3. 好了,试试装好没

# goaccess

看到以下结果就说明装好了

GoAccess - 0.5

Usage: goaccess [ -e IP_ADDRESS][ - a ][ - c ]< -f log_file >

The following options can also be supplied to the command:

-f - Path to input log file.
-c - Prompt log/date configuration window.
-a - Enable a List of User-Agents by host.
For faster parsing, don't enable this flag.
-e - Exclude an IP from being counted under the
HOST module. Disabled by default.

Examples can be found by running `man goaccess`.

For more details visit: http://goaccess.prosoftcorp.com
GoAccess Copyright (C) 2009-2012 GNU GPL'd, by Gerardo Orellana

原文作者:21Andy.com

4. GoAccess 使用方法
进入 Nginx 日志所在目录

命令行直接查看

# goaccess -f access.log -c -a

出来图了,日志格式选 NCSA 那项
最佳 Nginx 日志分析工具 GoAccess   Best Nginx log analyzer 03a6e8d1142c6916

也可以生成 HTML 报告

goaccess -f /var/log/nginx/access.log -a > report.html

zcat -f /var/log/nginx/access.log* | goaccess -a > report.html

OK,去爽吧!

另外:GoAccess 是个日志分析工具,不单单是 Nginx 的日志,支持多种格式

原文地址:http://www.21andy.com/new/20130522/2150.html 

 

300*300
 文章首页关于迷茫时代关于我写意人生
版权所有:迷茫时代 All rights reserved   
执行时间:0.00805 秒