Nginx 日志 IP 统计

Today access.log

    384 131.189.93.210
    340 183.94.132.87
    271 106.56.105.102
    230 114.95.111.36
    213 216.244.66.241
    185 121.10.198.7
    184 93.123.109.245
    177 38.254.120.233
    160 211.137.179.194
    160 20.171.207.47
    139 66.249.79.237
    137 66.249.79.238
    135 172.233.75.10
    134 66.249.79.236
     99 195.2.81.171
     95 183.7.148.177
     95 182.145.111.125
     94 119.129.51.91
     92 111.33.88.87
     90 39.128.169.89

Yesterday access.log.1

    608 216.244.66.241
    568 85.204.70.98
    361 139.196.159.168
    327 39.130.3.216
    243 66.249.79.236
    240 114.95.111.36
    228 34.174.219.158
    212 111.22.0.136
    210 66.249.79.237
    204 39.128.168.190
    197 183.207.45.116
    194 66.249.79.238
    190 143.244.57.86
    182 93.123.109.245
    180 119.190.33.22
    176 216.73.216.175
    160 211.137.179.194
    149 172.233.75.10
    148 183.7.150.191
    148 113.95.135.31

“Knowing is not enough, we must apply. Willing is not enough, we must do.” 🚢

✍ 功能简介

统计 Nginx 日志(access.log)中的请求量排名前 20 的 IP。 方便判断是否有恶意 IP 请求,或者非正规搜索引擎的爬虫 IP。

💻 Nginx 命令

$ awk '{print $1}' access.log | sort | uniq -c | sort -rn | head -n 20

📈 历史统计

累计使用次数:88