【nginx】通过nginx日志统计接口访问量
2022-05-21 本文已影响0人
Bogon
传统部署方式:
$ awk -F '######' '/HTTP/ {++state[$5]} END {for(key in state) print state[key], key}' /path/to/access.log | sort -t ' ' -k 1 -nr | head -n 100

k8s部署方式:
$ awk -F '##' '/HTTP/ {++state[$5]} END {for(key in state) print state[key], key}' /path/to/access.log | sort -t ' ' -k 1 -nr | head -n 100
