LoginSignup
2
1

More than 5 years have passed since last update.

NginxのLTSV形式のログから、アクセス数が多いIPを抽出する

Last updated at Posted at 2017-04-15

Webサービスを運用していると、特定のIPから大量のアクセスを受けるときがあります。
それを確認するための方法の一つして、NginxのLTSV形式のログから集計するという方法を紹介します。

cat access.log  | awk '{print $3}' | sort -n | uniq -c | sort -n

以下のように集計してい表示されます。Google Botが多いですね。

   6561 host:66.249.79.154
   7476 host:66.249.79.130
   9889 host:66.249.79.150
  12882 host:66.249.77.27
  15508 host:66.249.79.190
  35061 host:66.249.77.26
  63317 host:66.249.77.25
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1