my @loglist = nsort(@oldmsglogs); push(@loglist, "$basemsglog"); my @sortedlogs = (reverse @loglist); for $msglogfile (@sortedlogs) { if ($done eq 0) { $logfile = join('/', $baselogdir, $msglogfile); open(RDMESG, "-|", "tac", $logfile); while ( ) { my $line = $_; if ($line =~ m/(^[A-Z][a-z][a-z]\s+\d{1,2}\s+\d{1,2}\:\d{1,2}\:\d{1,2})(.*)/) { my $logtime = $1; my $msg = $2; my $logutime = str2time("$logtime"); if ($logutime ge $unixstarttime) { if ($msg =~ m/kernel\:\s+CPU\d{1,3}\:\s+Package\s+temperature\s+above\s+threshold\,\s+cpu\s+clock\s+throttled/) { $ctcnt++; } } else { $done = 1; last; } } } close RDMESG; } else { if ($ctcnt > $threshold) { $ret = sprintf("$warnmsg %d", $ctcnt); return $ret; } else { return $ret; } } } if ($ctcnt > $threshold) { $ret = sprintf("$warnmsg %d", $ctcnt); return $ret; }