Open onlytiancai opened 3 months ago
统计 Nginx 日志中请求量最大的 10 个国家
cat /var/log/nginx/access.log | awk '{print $1}'|xargs -I {} ./mmdbinspect -db ./GeoLite2-City_20240329/GeoLite2-City.mmdb {} | jq -r '.[].Records[].Record.country.iso_code' | sort | uniq -c | sort -rn | head
1846 DE
95 CN
81 US
53 RU
51 SG
42 IE
35 NL
14 BG
7 RO
6 PL
免费 IP 库:https://dev.maxmind.com/geoip/geolite2-free-geolocation-data 使用:
参考:https://github.com/maxmind/mmdbinspect?tab=readme-ov-file#examples