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地址/t/t/t/t/t来源/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