Python implementation analyzes the number of visits per minute in each ip in the iis log
1 # iis log analysis, calculate the number of visits per ip in one minute 2 from collections import Counter 3 import datetime 4 5 f=open( " log.log " , " r " ) 6 pv_list= [] 7 for line in f: 8 if len(line.split())==15 : 9 # print(line.split()[0:2]) 10 func_time=line.split()[0]+ " " +line.split( )[1 ] 11 same_time=func_time.split(":")[0:2] 12 ip_time=line.split()[8]+" "+func_time.split(":")[0]+func_time.split(":")[1] 13 pv_list.append(ip_time) 14 pv_time_ip=Counter(pv_list) 15 for ip in pv_time_ip.keys(): 16 print("%s has visited my web %s in %s" % (ip.split()[0], pv_time_ip[ip],ip.split()[1:3]))