Nginx 日志 IP 统计

Today access.log

     69 47.123.117.52
     68 47.123.117.67
     66 47.123.117.43
     62 47.123.117.56
     60 47.123.117.65
     59 47.123.117.35
     59 47.123.117.25
     58 47.123.117.32
     57 47.123.117.81
     57 47.123.117.58
     57 47.123.117.24
     56 47.123.117.98
     56 47.123.117.87
     56 47.123.117.76
     56 47.123.117.45
     55 47.123.117.85
     55 47.123.117.33
     54 47.123.117.96
     54 47.123.117.86
     54 47.123.117.72

Yesterday access.log.1

    552 47.123.117.95
    542 47.123.117.50
    525 47.123.117.87
    521 47.123.117.52
    521 47.123.117.41
    519 47.123.117.42
    511 47.123.117.26
    510 47.123.117.58
    508 47.123.117.31
    507 47.123.117.89
    507 47.123.117.66
    506 47.123.117.33
    505 47.123.117.92
    505 47.123.117.48
    504 47.123.117.90
    504 47.123.117.29
    502 47.123.117.93
    500 47.123.117.56
    498 47.123.117.57
    497 47.123.117.75

“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

📈 历史统计

累计使用次数:1492