major/MySQLTuner-perl

Error / warning count from error log can over-count

jesusbagpuss opened this issue · 0 comments

MySQLTuner-perl/mysqltuner.pl

Lines 1590 to 1602 in 13ec507

while ( my $logLi = <$fh> ) {
chomp $logLi;
$numLi++;
debugprint "$numLi: $logLi"
if $logLi =~ /warning|error/i and $logLi !~ /Logging to/;
$nbErrLog++
if $logLi =~ /error/i
and $logLi !~ /(Logging to|\[Warning\].*ERROR_FOR_DIVISION_BY_ZERO)/;
$nbWarnLog++ if $logLi =~ /warning/i;
push @lastShutdowns, $logLi
if $logLi =~ /Shutdown complete/ and $logLi !~ /Innodb/i;
push @lastStarts, $logLi if $logLi =~ /ready for connections/;
}

The regexes used to summarise the error log file can over-count e.g. a log line:
[Note] Error reading relay log event: slave SQL thread was killed
will get flagged as an error.

The 'level' of the events flagged in the error log appear to be (for MariaDB at least):

  • [ERROR]
  • [Warning]
  • [Note] (not used for analysis)

Updating the regexes to include the [ and ] will prevent false matches, and also remove the need for the match on line 1597.

I'm not sure whether the log formatting has changed over the years - leading to the simplified regexes currently in use?