20150702 nginx 访问日志分析 goacesshtml
1.安装GoAccess须要一些系统支持库linux
yum install glib2 glib2-devel GeoIP-devel ncurses-devel zlib zlib-devel
2.若是yum库找不到Geo-IP 那么须要单独安装了.nginx
cd /usr/local/src wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.6.tar.gz wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
3.安装GeoIP库api
tar xzvf GeoIP-1.4.6.tar.gz cd GeoIP-1.4.6 ./configure && make && make install mv GeoIP.dat.gz /usr/local/share/GeoIP/
4.安装GoAccessui
$ wget http://tar.goaccess.io/goaccess-0.8.1.tar.gz $ tar -xzvf goaccess-0.8.1.tar.gz $ cd goaccess-0.8.1/ $ ./configure --enable-geoip --enable-utf8 $ make # make install
若是启动GoAccess的时候出现如下提示.net
goaccess: error while loading shared libraries: libGeoIP.so.1
能够使用这个命令解决unix
ln -s /usr/local/lib/libGeoIP.so* /lib64/
五、菜单
菜单介绍
F1 帮助菜单
F5 刷新
q 退出当前口窗、菜单、或是当前查看的选项
o 打开当前的选项、菜单
c 改变窗口配色(目前只有两种 默认和绿色)
SHIFT + TAB 从当前选定模块向后切换
RIGHT 打开当前选中模块,查看详细信息
s 经过日期排序,只会在访问请求模块起做用
S 经过点击次数排序,只会在访问请求模块起做用
/ 查看详细信息的窗口进行搜索
n 经过/进行查找后,查找下个匹配的内容的位置,若是没有则在窗口底部显示“search hit BOTTOM”
t 在查看详细信息窗口,移动指针到最顶部
b 在查看详细信息窗口,移动指针到最底部指针
六、例子日志
goaccess -f access.logcode
#排除某一ip
goaccess -e 123.123.123.123 -f /var/log/httpd/access_log
只统计来自某IP的记录
# grep ^123.123.123.123 /var/log/httpd/access_log | goaccess
http://my.oschina.net/mrco/blog/181737
http://blog.chinaunix.net/uid-24250828-id-3369023.html
http://www.linuxde.net/2013/03/12943.html