统计每日访问ip数脚本

#!/bin/bash

by:key1088

time1=`date -d '-1 days' +%d/%b/%Y`                                              #昨天的时间,与apache日志时间一样的格式
time2=`date +%Y%m%d -d '-1 days'`                                               #昨天的时间,年月日  例:2011/02/11
echo $time2 >> /stats/ipstream
awk -v day="$time1" '$4~day{print}' /usr/local/apache/logs/access_log|awk '{print $1}'|sort|uniq|wc -l >> /stats/ipstream