diff --git a/INTERNALS.md b/INTERNALS.md index 31bb2d4..aa6121f 100644 --- a/INTERNALS.md +++ b/INTERNALS.md @@ -6,6 +6,7 @@ * [Get login information steps](#mysqltuner-get-login-information-steps) * [System checks](#mysqltuner-system-checks) * [Server version checks](#mysqltuner-server-version-checks) +* [Error log file checks](#mysql-error-log-file-analysis) * [MySQL Storage engine general information](#mysql-storage-engine-general-information) * [Security checks](#mysqltuner-security-checks) * [CVE checks](#mysqltuner-cve-checks) @@ -39,6 +40,7 @@ * Get information about the tuning connexion * Check current MySQL version * Suggest 64-bit upgrade +* Analyze mysqld error log file * Show enabled storage engines * Show informations about databases (option: --dbstat) * Show informations about indexes (option: --idxstat) @@ -87,6 +89,13 @@ * Currently MySQL < 5.1 are EOF considered. * Using 5.5+ version of MySQL for performance issue (asynchronous IO). +## Mysql error log file analysis +* Look for potential current error log file name +* Check permission on error log file +* Check size on error log file +* Check error and warning on error log file +* Find last start and shutdown on error log file + ## MySQL Storage engine general information * Get storage engine counts/stats @@ -215,7 +224,7 @@ * MySQL needs 1 instance per 1Go of Buffer Pool * innodb_buffer_pool instances = round(innodb_buffer_pool_size / 1Go) * innodb_buffer_pool instances must be equals or lower than 64 - + - A bug in MySQL 5.6 causes SHOW VARIABLES to report an innodb_buffer_pool_instances value of 8 when innodb_buffer_pool_size is less than 1GB and only one buffer pool instance is present (Bug #18343670). * InnoDB Buffer Pool Usage diff --git a/README.md b/README.md index 65a50a6..21a4a79 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,7 @@ You can follow this command to create a new database sys containing very useful cd mariadb-sys-master/ mysql -u root -p < ./sys_10.sql -Errors & solutions for performance schema +Errors & solutions for performance schema installation ERROR at line 21: Failed to open file './tables/sys_config_data_10.sql -- ported', error: 2 Have a look at #452 solution given by @ericx diff --git a/mysqltuner.pl b/mysqltuner.pl index 9a330cd..0768b79 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -1197,12 +1197,36 @@ sub get_log_file_real_path { if ( -f "$file" ) { return $file; } + elsif ( -f "$hostname.log" ) { + return "$hostname.log"; + } elsif ( -f "$hostname.err" ) { return "$hostname.err"; } - elsif ( $datadir ne "" ) { + elsif ( -f "$datadir$hostname.err" ) { return "$datadir$hostname.err"; } + elsif ( -f "$datadir$hostname.log" ) { + return "$datadir$hostname.log"; + } + elsif ( -f "$datadir"."mysql_error.log" ) { + return "$datadir"."mysql_error.log"; + } + elsif ( -f "/var/log/mysql.log" ) { + return "/var/log/mysql.log"; + } + elsif ( -f "/var/log/mysqld.log" ) { + return "/var/log/mysqld.log"; + } + elsif ( -f "/var/log/mysql/$hostname.err" ) { + return "/var/log/mysql/$hostname.err"; + } + elsif ( -f "/var/log/mysql/$hostname.log" ) { + return "/var/log/mysql/$hostname.log"; + } + elsif ( -f "/var/log/mysql/"."mysql_error.log" ) { + return "/var/log/mysql/"."mysql_error.log"; + } else { return $file; } @@ -1212,16 +1236,19 @@ sub log_file_recommendations { $myvar{'log_error'} = get_log_file_real_path( $myvar{'log_error'}, $myvar{'hostname'}, $myvar{'datadir'} ); + subheaderprint "Log file Recommendations"; - infoprint "Log file: " - . $myvar{'log_error'} . "(" - . hr_bytes_rnd( ( stat $myvar{'log_error'} )[7] ) . ")"; if ( -f "$myvar{'log_error'}" ) { goodprint "Log file $myvar{'log_error'} exists"; } else { badprint "Log file $myvar{'log_error'} doesn't exist"; + return; } + infoprint "Log file: " + . $myvar{'log_error'} . "(" + . hr_bytes_rnd( ( stat $myvar{'log_error'} )[7] ) . ")"; + if ( -r "$myvar{'log_error'}" ) { goodprint "Log file $myvar{'log_error'} is readable."; }