python分析apache访问日志脚本分享
程序员文章站
2022-04-20 23:37:25
...
#!/usr/bin/env python # coding=utf-8 #------------------------------------------------------ # Name: Apache 日志分析脚本 # Purpose: 此脚本只用来分析Apache的访问日志 # Version: 2.0 # Author: LEO # Created: 2013-4-26 # Modified: 2013-5-4 # Copyright: (c) LEO 2013 #------------------------------------------------------ import sys import time #该类是用来打印格式 class displayFormat(object): def format_size(self,size): '''格式化流量单位''' KB = 1024 MB = 1048576 GB = 1073741824 TB = 1099511627776 if size >= TB : size = str(size / TB) + 'T' elif size = GB and size = MB and size