标签 goaccess 下的文章

1.安装

以下内容可能已过期,只用作参考,请根据最新 官方安装说明 进行安装

    $ sudo yum install -y epel-release
    $ sudo yum install -y goaccess

2. 修改 nginx 日志格式

使用 goaccess 分析 nginx 日志,需要特定格式,修改nginx.conf log_format

    #vim /etc/nginx/nginx.conf
    
    # log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                   '$status $body_bytes_sent "$http_referer" '
    #                   '"$http_user_agent" "$http_x_forwarded_for"';
    
    log_format  main  '$remote_addr - $remote_user [$time_local] requesthost:"$http_host"; "$request" requesttime:"$request_time"; '
            '$status $body_bytes_sent "$http_referer" - $request_body'
            '"$http_user_agent" "$http_x_forwarded_for"';

- 阅读剩余部分 -