Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

开发工具系列之—GoAcess:Nginx日志分析利器 #68

Open
johnnian opened this issue Jul 23, 2019 · 0 comments
Open

开发工具系列之—GoAcess:Nginx日志分析利器 #68

johnnian opened this issue Jul 23, 2019 · 0 comments
Labels

Comments

@johnnian
Copy link
Owner

johnnian commented Jul 23, 2019

Nginx日志分析工具—GoAcess

1、安装方法

安装方法参考: https://goaccess.io/download

在MacOS下安装比较简单:

brew install goaccess

2、基础使用方法

步骤1: Nginx需要开启访问日志,格式如下:

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for" "$request_body"';

步骤2: GoAcess的配置文件

➜  vi goaccess.conf

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

步骤3: 具体分析Nginx日志,并且查看结果

➜  goaccess -a -d -f ./nginx.log -p ./goaccess.conf -o ./out.html  --hour-spec=min --date-spec=hr --date-spec=hr

具体的页面如下:

WX20190723-111734@2x

每个模块的说明,可以参考:https://goaccess.io/man#description

3、参考

@johnnian johnnian added the Tools label Jul 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant