#!/usr/bin/perl # name: logcalc.pl # calc the amount of access url use strict; use warnings; use diagnostics; use File::Basename; my ($arg, $arg_only); my $FILE; my ($year, $month, $day, $mon); my ($time, $method, $url); my ($amount, $hour, $key, $va
前言:python统计apache.nginx访问日志IP访问次数并且排序(显示前20条).其实用awk+sort等命令可以实现,用awk数组也可以实现,这里只是用python尝试下. apache脚本: ips = {} with open("/root/mail_access_log-20180629") as fh: for line in fh: ip = line.split(" ")[0] if 6 < le