GoAccess 视图化access.log 日志

217 阅读1分钟

1.安装GoAccess 工具可以直接使用

apt-get install goaccess

2.使用goaccess命令将日志生成html文件

goaccess 日志路径 -o 输出HTML的路径 --real-time-html --time-format="%H:%M:%S" --date-format="%d/%b/%Y" --log-format=COMBINED

--real-time-html  表示实时的显示日志内容

--time-format    时间格式

--date-format    日期格式

--log-format      用于指定日志字符串格式

命令执行完后开启一个websocket服务用来实时更新日志数据

3.为生成的html文件搭建一个web服务,例如使用nginx配置一个服务

123456789server {``                ``listen       8080;``                ``server_name  localhost;``                ``access_log logs/proxy.access.log proxy;``                ``location /report.html{``                        ``alias /home/wwwroot/goaccess/report.html;``                ``}         ``}  

然后访问 http://ip:8080 出现下图所示

至此日志数据图形化完成,更多使用方式请访问官网

GoAccess中文网