Nick Le Mouton wrote:
> I've been having some problems with some dodgy spiders accessing my
> website and taking it down by overloading it. At the moment we use
> analytics and awstats for stats, but it doesn't give a real time view
> of who's accessing our website.
>
> I found a command to run across the apache access file which will show
> how many times an IP is logged in x lines of the log file.
>
> tail -100000 access.log | awk '{print $1}' | sort | uniq -c |sort -nr
>
> This is fine, but I'd like to setup a system to do this automatically,
> something that would show me easily who the top IP's were for the last
> hour/day (across 5 web servers).
>
getting the last hour / day's log from the apache logfile - use the
command you already have, but replace "tail -100000 access.log" with
grep $( date +%d/%h/%Y:%H ) access.log
(presuming your log format is like "11/Nov/2008:16:35:03 +1300", and you
run this at 59 * * * *)
--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---