The company's new demand, suspected PV and IP ratio is not right, see if there is malicious east:
Nginx Configuration:
Log_format main "" $http _user_agent "" $http _x_cookie "" $request _time "" $upstream _response_time "" $upstream _cache_status "" $uid " ';
" - " ; if " uid= (\s+) (;. *|$){ set $uid $1; }
PV Top 20 Leaderboard:
cat test.log| sort | awk $NF!~/-/{print $ "," $NF} " | uniq | awk -F, {print $ " | uniq -c| sort -nr| head -20
12 53.27.4.22
1 61.183.86.163
1 61.183.237.146
1 58.255.215.115
1 27.154.152.131
1 223.240.50.192
1 222.94.205.228
1 219.140.69.67
1 218.89.115.155
1 218.28.77.119
1 183.63.212.176
1 183.54.95.254
1 182.107.39.76
1 163.179.53.171
1 14.130.237.192
1 124.207.249.82
1 124.128.87.134
1 124.117.198.63
1 122.224.216.242
1 121.61.112.2
Total IP number of the company:
Cat Test.log| Sort| awk ' $NF!~/-/{print $ "," $NF} '| Uniq | awk -F '{print $}'| Uniq -c| Sort -nr| WC -L
32
Total UV number of the company:
Cat Test.log| Sort| awk ' $NF!~/-/{print $ "," $NF} '| Uniq | awk -F '{print $}'| Uniq -c| Sort -nr| awk ' Begin{total=0}{total=total+$1}end{print "UV is:" Total} '
UV is:43
Nginx combined with Shell statistics user's UV and IP summary