GoAccess 是一款开源的且具有交互视图界面的实时 Web 日志分析工具,通过你的 Web 浏览器或者*nix系统下的终端程序(terminal)即可访问。能为系统管理员提供快速且有价值的 HTTP 统计,并以在线可视化服务器的方式呈现。
官方演示页面:https://rt.goaccess.io/?20170729002319
一、安装依赖
1、最终日志统计时显示IP地理位置:
yum install -y GeoIP-devel.x86_64
2、安装ncurses-devel开发库:
yum install -y ncurses-devel
3、安装tokyocabinet-devel开发库:
yum install -y tokyocabinet-devel
4、安装openssl-devel开发库:
yum install -y openssl-devel
二、安装gooaccess
1、下载源码包
wget http://tar.goaccess.io/goaccess-1.2.tar.gz
2、解压并安装:
tar -zxvf goaccess-1.2.tar.gz
cd goaccess-1.2
./configure --enable-utf8 --enable-geoip=legacy
make && make install
三、更改goaccess配置文件
1、进入配置文件
vim config/goaccess.conf
2、更改配置文件
删除此三行前#,wq保存退出
四、生成动态日志监控页面
goaccess -f /var/log/httpd/access_log -o /var/www/html/cms6/gooaccess.html -p ./config/goaccess.conf
/var/log/httpd/access_log //apache日志文件
/var/www/html/cms6/gooaccess.html //生成页面的存放路径
./config/goaccess.conf //配置文件路径