$ cut -d' ' -f 1 <access_log> | sort -n | uniq
Substitute the path of your apache access log, and it'll spit out a list of all IP addresses that have accessed your server.
Here's what that command is doing:
cut -d' ' -f 1 <access_log>
This will list out the first field of the access_log, using the space character as a delimiter. The output of this is then piped to:
sort -n
This, as you'd expect, does a numeric sort of the data received and then pipes the resulting list to:
uniq
Which eliminates duplicate entries on adjacent lines. Its output is displayed on-screen.\
http://serverfault.com/questions/267862/check-the-ip-addresses-accessing-my-server
No hay comentarios:
Publicar un comentario