统计nginx访问日志,access.log形式:
1xx.xx.xxx.xxx - - [09/Oct/2017:10:48:21 +0800] "GET /p_w_picpaths/yyy/2044/974435412336/Cover/9787503434r.jpg HTTP/1.1" 304 0 "http://www.xxx.net/" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/xx.0.xx2.xx Safari/537.36" "0.001" "-" "-" "-""xxx.xxx.xxx.xxx:xxxx" "304" "0" "0.001"
(1)将被访问的域名和次数存入数据库中
(2)将下载量排名前10的列出来
方法:读取access.log日志将其所需要信息截取出来生成字典,利用字典键的唯一性统计出下载次数,并将字典进行排序,截取出排名前10的域名和下载次数