Nginx log 分析
goaccess access.log -o /var/www/html/report.html --log-format=COMBINED --real-time-html --ws-url=wss://tld.com:443/ws
log file size limit: https://serverfault.com/questions/427144/how-to-limit-nginx-access-log-file-size-and-compress
# 统计 IP 数目awk '{print $1}' access.log | sort -n | uniq | wc -l
# 统计某个时间段的 IP 数目grep "07/Apr/2017:0[4-5]" access.log | awk '{print $1}' | sort | uniq -c| sort -nr | wc -l
# 访问最平凡的 100 个 urlawk '{print $7}' access.log | sort |uniq -c | sort -rn | head -n 100
# 每分钟请求数awk '{print $4}' access.log | cut -c 14-18 | sort | uniq -c | sort -nr | head -n 100
# 禁止特定 UA 访问if ($http_user_agent ~ "Lua"){return 403;}