Python Apache日志处理脚本

#!/usr/bin/python #coding=gb2312 
 f=open('/var/log/apache2/access.log','r'); log=f.readline().rstrip(); log_home=log.split(); print log_home; ip=log_home[0]; date=log_home[3].replace('[',''); point=log_home[5].replace('"',''); path=log_home[6]; offer=log_home[8]; web=log_home[11].replace('"',''); print ip+'\t'+date+'\t'+point+'\t'+path+'\t'+offer+'\t'+web; f.close();

 

你可能感兴趣的:(Python Apache日志处理脚本)