Friday, January 3, 2014

Apache logs: Get unique visitors in the last 60 seconds

This is modified from:

To get the number of unique visitors (by ip) in the last 60 seconds from an Apache log:

awk  '{if ( substr($4,14) > strftime("%H:%M:%S", systime()-(60) )  && substr($4,2,9) == strftime("%d/%b/%C")) !a[$1]++}END{for(i in  a) k++; print k }' access_log

1 comment:

Kevin Collins said...

Hi. I really enjoyed my brief visit on your site and I’ll be sure to be back for more.
Can you please consider placing my website on your link list?

Please email me back.