所以在中国的某个人只是喜欢在我的networking工具网站上滥用垃圾信息在yougetsignal.com 。
我一直试图分析我的access.log文件,以确切地看到他们如此兴奋。 我的网站上的大部分服务都使用MySQL调用来限制使用率的历史logging,而且大多数情况下,这是抑制过度使用的一个好方法。 每过一段时间,他们都会使用大量的IP地址来达到这个目的,以避免IP速率的限制。
我一直在玩这两个命令来分析我的Apache access.log文件:
sudo cat access.log | awk '{print $1}' | sort | uniq -c |sort -n // Output sample: // 3453 83.251.250.130 // 3888 79.136.28.38 // 4268 94.75.220.77 // 7116 61.147.122.183
和
sudo tail -50000 access.log | awk '{print $1}' | sort | uniq -c |sort -n // Output sample: // 276 66.249.68.86 // 365 155.212.251.138 // 1093 61.147.122.183
最后:
awk '{print $7}' access.log|cut -d? -f1|sort|uniq -c|sort -nk1|tail -n10 // Output sample: // 15405 heavy-use-file.php // 22339 heavy-use-file.php // 218121 very-heavy-use-file.php
我需要的最后一件事情是将访问计数,IP地址和文件连在一起。 是否有可能编写一个shell命令,告诉我发出最多请求的IP地址,特别是哪个文件要求以count递减? 我不是Linux大师,所以我在这里寻求帮助。
怎么样 :
awk '{print $1,$7}' access.log | cut -d? -f1 | sort | uniq -c |sort -nr
你有没有看过AWStats ? 分析来自日志文件的所有数据是非常棒的
apachetop是你的朋友。 它为您提供类似于top命令的视图,但为Apache访问日志。 可以按命中,千字节等对视图进行sorting。
您可以实时使用它或者提供一个较旧的日志。