查询ip地址所用的组件
wget http://rfyiamcool.googlecode.com/files/nali-0.1.tar.gz
tar zxvf nali-0.1.tar.gz
cd nali-0.1
./configure && make && make install
步骤和nginx是差不多的,只是取日志里面的ip地址的方法不一样~~~
#!/bin/bash
#rfyiamcool
IPSUMFILE=access_ip.log
SAVEFILE=ipaddress.txt
echo -e "IP地址ttttt来源n----------------------------------------------------">$SAVEFILE
#log path
LOG_DIR=/usr/local/apache/logs/
for i in $LOG_DIR/*.log
do
cat /etc/httpd/logs/access_log|awk '{print $1}'|sort|uniq -c|sort -nr|awk '{print $2}'>>$IPSUMFILE
done
for i in `cat $IPSUMFILE`
do
nali $i >> $SAVEFILE
done
最后cat 查看~~