使用perl统计日志中单位时间内的请求数

使用perl统计日志中单位时间内的请求数,第1张

概述$file="g:/log/x.log";%map=();open(IN,"<$file") || die "Couldn't open $filename for reading: $!";$num=0;$v=0;$str="";while($line=<IN>){ if (!($line=~m/.*logid.*phonenumber.*message.*/)) {#不匹配就继
$file="g:/log/x.log";%map=();open(IN,"<$file") || dIE "Couldn't open $filename for reading: $!";$num=0;$v=0;$str="";while($line=<IN>){	if (!($line=~m/.*logID.*phonenumber.*message.*/)) {#不匹配就继续循环		next;	}	#print $line."\n";	$str=substr($line,20);#cut str		if(exists ($map{$str}))	{		$v=$map{$str};		$v++;		$map{$str}=$v;	}else{		$map{$str}=1;	}	#print $str."===".$map{$str}."\n";}close($IN);while (($key,$value) = each(%map) ) {	if($value>40){		print "$key ------$value "."\n";	}}
总结

以上是内存溢出为你收集整理的使用perl统计日志中单位时间内的请求数全部内容,希望文章能够帮你解决使用perl统计日志中单位时间内的请求数所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/1278733.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-09
下一篇2022-06-09

发表评论

登录后才能评论

评论列表(0条)

    保存