Apache Log filter user based on IP

Pendem Shiva Shankar
1 min readFeb 4, 2020

we are familier that apache we server is the most common webserver for small and medium web applications,

in some cases we would need to check the logs to filter spam hits and spam requests for a website which was with ddos or other attacks,

consider the access file is “access.log”, here is the command that is used to filter all users with ip and their no of requests count.

awk ‘{ print $1}’ access.log | sort | uniq -c | sort -nr | head -n 10

this gives the list of users ip and the request time count as

5482 103.28.37.178
5356 66.249.78.168
1977 66.249.93.145
1962 157.55.39.251
1924 66.249.93.142
1921 66.249.93.148
1890 64.233.173.178
1860 108.61.183.134
1841 64.233.173.182
1582 157.55.39.251

There are many methods that can be used to achieve this, if you know any better way do share in the comments and also in case of any suggestions or questions, remember to leave a comment and we shall discuss it together. Hope you find this article helpful.

If you find this article is helpful, it would be greatly appreciated if you could tip Ether to the address below. Thank you!

0xe8312ec868303fc3f14DeA8C63A1013608038801

For more info reach me on my telegram id @chigovera .

--

--