獲取客戶端ip訪問網站的次數和請求頁面腳本
阿新 • • 發佈:2018-05-21
客戶端ip訪問網站的次數和請求頁面腳本獲取客戶端ip訪問網站的次數和請求頁面
#/bin/bash cd /data/iplog/$1/pv txt=$(ls -l|awk ‘{print $NF}‘|sed ‘1d‘) for n in $txt do ip=$(cat /root/iplist) for n1 in $ip do grep $n1 $n >>/opt/txt01/$n1-$1-cpv.txt done done rep_txt=$(cd /opt/txt01/&&ls -l *cpv.txt|awk ‘{print $NF}‘|sed ‘1d‘) cd /opt/txt01 for n2 in $rep_txt do ##cat $n2 |awk -F [/] ‘{print $3}‘|sort|uniq -c|sort -nr >>$n2-test cat $n2|awk -F ‘[ ]+‘ ‘{print $4}‘|sort|uniq -c|sort -nr >>/opt/txt02/$n2-cpv done cd /opt/ tar zcf /opt/txt02/$1-$2-cpv-iplog.tar.gz ./txt02 [root@git-server test001]# cat /root/iplist 117.136.79.39 117.136.79.32 117.136.79.33 117.136.79.37 117.136.79.36 120.239.77.229 223.104.63.150 [root@git-server test001]# cd /opt/txt01/ [root@git-server txt01]# ls 117.136.79.32-2018-05-17-cpv.txt 117.136.79.36-2018-05-17-cpv.txt 117.136.79.39-2018-05-17-cpv.txt 223.104.63.150-2018-05-17-cpv.txt 117.136.79.33-2018-05-17-cpv.txt 117.136.79.37-2018-05-17-cpv.txt 120.239.77.229-2018-05-17-cpv.txt [root@git-server txt01]# cd /opt/txt02/ [root@git-server txt02]# ls 117.136.79.33-2018-05-17-cpv.txt-cpv 117.136.79.37-2018-05-17-cpv.txt-cpv 120.239.77.229-2018-05-17-cpv.txt-cpv 223.104.63.150-2018-05-17-cpv.txt-cpv 117.136.79.36-2018-05-17-cpv.txt-cpv 117.136.79.39-2018-05-17-cpv.txt-cpv 2018-05-17-233-cpv-iplog.tar.gz
[root@git-server txt01]# head -10 /opt/txt02/117.136.79.37-2018-05-17-cpv.txt-cpv 6 http://m.31xs.net/13/13431/10319091.html 4 https://m.yubook.net/novel/61462/7938632.html 4 https://m.ybdu.com/xiaoshuo/18/18935/6895763.html 4 https://m.xiaoshuoli.com/i35445/18566473.html 4 https://m.xiaoshuoli.com/i18640/18476060.html 4 https://m.biquxu.com/24/24853/12085909.html 4 http://m.wutuxs.com/html/1/1071/842907.html 4 http://m.sanhao33.com/sort-8-5/ 4 http://m.jw46.com/sort/ 4 http://m.bxwx.io/book_77838/22048312.html
獲取客戶端ip訪問網站的次數和請求頁面腳本