goaccess 分析nginx日志例子

格式

log_format main ‘$remote_addr – $remote_user [$time_local] “$request” ‘
    ‘$status $body_bytes_sent “$http_referer” ‘
    ‘”$http_user_agent” “$http_x_forwarded_for”‘;

日志

127.0.0.1 – – [25/Sep/2018:12:02:10 +0800] “GET /admin/role-auth HTTP/1.1” 200 13545 “http://t.lonlife.cn:9200/admin/admin-roles” “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36” “-“

命令

goaccess -f /var/log/nginx/b.log –log-format=‘%h %^[%d:%t %^] “%r” %s %b “%R” “%u” %^‘ –date-format=%d/%b/%Y –time-format=%T