这篇文章主要介绍了python分析apache访问日志脚本分享,本文直接给出实现代码,需要的朋友可以参考下
#!/usr/bin/env python # coding=utf-8 #------------------------------------------------------ # Name: Apache 日志分析脚本 # Purpose: 此脚本只用来分析Apache的访问日志 # Version: 2.0 # Author: LEO # Created: 2013-4-26 # Modified: 来源gao@daima#com搞(%代@#码网 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
以上就是python分析apache访问日志脚本分享的详细内容,更多请关注gaodaima搞代码网其它相关文章!