<pre name="code" class="sql">my $dir = '/usr/local/apache-tomcat-7.0.55_8082/logs';
my $SDATE = strftime("%Y-%m-%d",localtime());
my $file = "localhost.$SDATE.log";
$mon_file = "$dir/$file";
##########监控关键字,以空格隔开################
###$count 上一次Exception的次数
@warn_arr = qw/Exception/;
foreach $a (@warn_arr) {
undef @err_info;
open( C, "<", "$a.tmp" );
while (<C>) {
$count = $_;
}
print "\=========================================================================================================================\n";
print "\######监控异常关键字: \"$a\"---数量=$count\n";
##$b是匹配到Exception关键字的最后行的行号
##$i是当前匹配Exception的行数
open( A, "<", "$mon_file" ) || die "$!\n";
$i = 0;
$num = 0;
$b = 0;
while (<A>)
perl 监控日志告警
最新推荐文章于 2023-02-09 15:41:25 发布