日志格式:
#Version: 1.0
#Fields: date time time-taken x-c_username bytes c-ip s-ip sc-status cs-method cs-uri-stem cs-uri x-c_sessionid
#Software: WebLogic
#Start-Date: 2017-03-27 00:01:13
2017-03-27 00:01:13 0.043 - 32 10.33.215.218 10.12.216.147:30573 200 POST /appsvr/apv/blazeThreeSwitchForEsg /appsvr/apv/blazeThreeSwitchForEsg -
2017-03-27 00:01:22 0.0050 GROUPUSER 297 10.11.100.136 10.12.216.147:30573 302 GET /index.jsp / ‘B72BYXlSvxQJpBlTwPvVpZ2LtZvQNstnl0fnPpqn2QzSVwSgr224!1792055119!1490544082940‘
2017-03-27 00:01:23 0.269 GROUPUSER 10463 10.11.100.136 10.12.216.147:30573 200 GET /cfs/index.screen /cfs/index.screen ‘B72BYXlSvxQJpBlTwPvVpZ2LtZvQNstnl0fnPpqn2QzSVwSgr224!1792055119!1490544082940‘
2017-03-27 00:01:23 0.07 GROUPUSER 10463 10.11.100.136 10.12.216.147:30573 200 GET /cfs/index.screen /cfs/index.screen ‘B72BYXlSvxQJpBlTwPvVpZ2LtZvQNstnl0fnPpqn2QzSVwSgr224!1792055119!1490544082940‘
2017-03-27 00:01:23 0.0020 GROUPUSER 12830 10.11.100.136 10.12.216.147:30573 200 GET /cfs/top.jsp /cfs/top.jsp ‘B72BYXlSvxQJpBlTwPvVpZ2LtZvQNstnl0fnPpqn2QzSVwSgr224!1792055119!1490544082940‘
2017-03-27 00:01:29 0.0 - 30 10.12.216.2 10.12.216.147:30573 200 GET /f5monweb/f5check.jsp /f5monweb/f5check.jsp -
2017-03-27 00:01:37 0.037 DAIBANGXING471 33 10.53.209.86 10.12.216.147:30573 200 POST /cfs/approval/querySystemHuEndAlert.do /cfs/approval/querySystemHuEndAlert.do ‘tCppYJxJJ1fpfQkT4MGDTNMNZZXtPVT4FKTrxGjrYCSGnkLlg0p8!1792055119!1490334025837‘
2017-03-27 00:02:33 0.011 LUQIAN307 33 10.53.209.65 10.12.216.147:30573 200 POST /cfs/approval/querySystemHuEndAlert.do /cfs/approval/querySystemHuEndAlert.do ‘Q6Q1YXnJlqVdTww1LryvzR84cx4LTNxcKP2YDHHzDhfppKl1CCdh!1792055119!1490530004923‘
2017-03-27 00:02:54 0.033 DAIBANGXING471 33 10.53.209.86 10.12.216.147:30573 200 POST /cfs/approval/querySystemHuEndAlert.do /cfs/approval/querySystemHuEndAlert.do ‘tCppYJxJJ1fpfQkT4MGDTNMNZZXtPVT4FKTrxGjrYCSGnkLlg0p8!1792055119!1490334025837‘
2017-03-27 00:03:18 0.0090 DUXIAOLING239 33 10.53.208.159 10.12.216.147:30573 200 POST /cfs/approval/querySystemHuEndAlert.do /cfs/approval/querySystemHuEndAlert.do ‘5yLbYJSKlyBy1LTYf72XqQFQ2NWnQsFx2FRCWGnnRv6kHSljhP1v!1792055119!1490342474332‘
2017-03-27 00:03:21 0.0010 - 30 10.12.216.1 10.12.216.147:30573 200 GET /f5monweb/f5check.jsp /f5monweb/f5check.jsp -
2017-03-27 00:03:41 0.637 CHENSHU524 33 10.53.185.0 10.12.216.147:30573 200 POST /cfs/approval/querySystemHuEndAlert.do /cfs/approval/querySystemHuEndAlert.do ‘yLB4YJ5PmmshQ5hS27QcPcjB317Kysh8xrR7yZVPmn0vbTbQdyvQ!1792055119!1490352559754‘
2017-03-27 00:03:45 0.0010 - 30 10.33.226.5 cfs-apvWIIWebServer8130.instance.paic.com.cn:30573 200 GET /f5monweb/f5check.jsp /f5monweb/f5check.jsp -
2017-03-27 00:03:59 0.54 DAIBANGXING471 33 10.53.209.86 10.12.216.147:30573 200 POST /cfs/approval/querySystemHuEndAlert.do /cfs/approval/querySystemHuEndAlert.do ‘tCppYJxJJ1fpfQkT4MGDTNMNZZXtPVT4FKTrxGjrYCSGnkLlg0p8!1792055119!1490334025837‘
2017-03-27 00:04:01 0.0 - 30 10.12.216.1 10.12.216.147:30573 200 GET /f5monweb/f5check.jsp /f5monweb/f5check.jsp -
2017-03-27 00:04:01 4.282 - 86 10.33.213.93 10.12.216.147:30573 200 POST /appsvr/apv/preApproved /appsvr/apv/preApproved -
2017-03-27 00:04:01 0.024 WANGZHENZHEN707 33 10.53.209.71 10.12.216.147:30573 200 POST /cfs/approval/querySystemHuEndAlert.do /cfs/approval/querySystemHuEndAlert.do ‘pQYmYXbh4RJWQwmcvvt5yDSpg45qNWxwLRQcnYWThvFhthyQt562!1792055119!1490492282307‘
2017-03-27 00:09:58 0.012 CHENSHU524 33 10.53.185.0 10.12.216.147:30573 200 POST /cfs/approval/querySystemHuEndAlert.do /cfs/approval/querySystemHuEndAlert.do ‘yLB4YJ5PmmshQ5hS27QcPcjB317Kysh8xrR7yZVPmn0vbTbQdyvQ!1792055119!1490352559754‘
2017-03-27 00:10:03 0.02 WANGZHENZHEN707 33 10.53.209.71 10.12.216.147:30573 200 POST /cfs/approval/querySystemHuEndAlert.do /cfs/approval/querySystemHuEndAlert.do ‘pQYmYXbh4RJWQwmcvvt5yDSpg45qNWxwLRQcnYWThvFhthyQt562!1792055119!1490492282307‘
2017-03-27 00:10:03 0.012 DUXIAOLING239 33 10.53.208.159 10.12.216.147:30573 200 POST /cfs/approval/querySystemHuEndAlert.do /cfs/approval/querySystemHuEndAlert.do ‘5yLbYJSKlyBy1LTYf72XqQFQ2NWnQsFx2FRCWGnnRv6kHSljhP1v!1792055119!1490342474332‘
2017-03-27 00:10:09 0.0 - 30 10.12.216.2 10.12.216.147:30573 200 GET /f5monweb/f5check.jsp /f5monweb/f5check.jsp -
2017-03-27 00:10:11 0.014 LUQIAN307 33 10.53.209.65 10.12.216.147:30573 200 POST /cfs/approval/querySystemHuEndAlert.do /cfs/approval/querySystemHuEndAlert.do ‘Q6Q1YXnJlqVdTww1LryvzR84cx4LTNxcKP2YDHHzDhfppKl1CCdh!1792055119!1490530004923‘
import sys,linecache,time #filename=sys.argv[1] dateTime=raw_input("Pls enter the date (YYYY-mm-dd):") #dateTime="2017-03-27" #filename="D:\Users\WANWEI496\Downloads\cfs-apvWIIWebServer8130-20170327\cfs-apvWIIWebServer8130-20170327\cfs-apvWIIWebServer8130.acc00001" filename=raw_input("And ur filename:") lineNum=len(linecache.getlines(filename)) #print #print "Total: ",lineNum time.sleep(3) s=set() num=0 while True: if num < lineNum: cacheBig=linecache.getlines(filename)[num] if cacheBig.startswith(dateTime): username=cacheBig.split()[3] s.add(username) #print num num+=1 continue else: num+=1 continue else: break #print s linecache.clearcache() s.remove(‘-‘) print print "User account: ",len(s)