CentOS 安装GoAccess对Nginx日志分析

cera cera

GoAccess是一个非常棒的Nginx日志分析工具, 先简单分享一下安装和使用方法.

 

以CentOS 7为例

安装

yum install goaccess -y

编辑配置文件

vi /etc/goaccess.conf

把这些配置前面的#去掉, 使其生效

time-format %H:%M:%S
date-format %d/%b/%Y
log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u"

生成html文本报告.

goaccess -f /www/wwwlogs/mysite.com.log -o /home/www/default/mysite.com/report.html

注意: 这里需要根据自己的情况选择好日志和输出报告路径, 以实际情况为准.
查看报告请访问你的网站
http://mysite.com/report.html

命令参数

$ goaccess -h
# 常用参数
-a --agent-list 启用由主机用户代理的列表。为了更快的解析,不启用该项
-d --with-output-resolver 在HTML/JSON输出中开启IP解析,会使用GeoIP来进行IP解析
-f --log-file 需要分析的日志文件路径
-p --config-file 配置文件路径
-o --output 输出格式,支持html、json、csv
-m --with-mouse 控制面板支持鼠标点击
-q --no-query-string 忽略请求的参数部分
--real-time-html 实时生成HTML报告
--daemonize 守护进程模式,--real-time-html时使用


参考
https://goaccess.cc/
https://www.fanhaobai.com/2017/06/go-access.html

cera cloudiplc tengxunyun

相关推荐

mjjping.com cera cera cloudiplc