Skip to content

Commit b8f191d

Browse files
committed
Update error log file analysis
1 parent 7332f8d commit b8f191d

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

INTERNALS.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* [Get login information steps](#mysqltuner-get-login-information-steps)
77
* [System checks](#mysqltuner-system-checks)
88
* [Server version checks](#mysqltuner-server-version-checks)
9+
* [Error log file checks](#mysql-error-log-file-analysis)
910
* [MySQL Storage engine general information](#mysql-storage-engine-general-information)
1011
* [Security checks](#mysqltuner-security-checks)
1112
* [CVE checks](#mysqltuner-cve-checks)
@@ -39,6 +40,7 @@
3940
* Get information about the tuning connexion
4041
* Check current MySQL version
4142
* Suggest 64-bit upgrade
43+
* Analyze mysqld error log file
4244
* Show enabled storage engines
4345
* Show informations about databases (option: --dbstat)
4446
* Show informations about indexes (option: --idxstat)
@@ -87,6 +89,13 @@
8789
* Currently MySQL < 5.1 are EOF considered.
8890
* Using 5.5+ version of MySQL for performance issue (asynchronous IO).
8991

92+
## Mysql error log file analysis
93+
* Look for potential current error log file name
94+
* Check permission on error log file
95+
* Check size on error log file
96+
* Check error and warning on error log file
97+
* Find last start and shutdown on error log file
98+
9099
## MySQL Storage engine general information
91100

92101
* Get storage engine counts/stats
@@ -215,7 +224,7 @@
215224
* MySQL needs 1 instance per 1Go of Buffer Pool
216225
* innodb_buffer_pool instances = round(innodb_buffer_pool_size / 1Go)
217226
* innodb_buffer_pool instances must be equals or lower than 64
218-
227+
219228
- 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).
220229

221230
* InnoDB Buffer Pool Usage

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ You can follow this command to create a new database sys containing very useful
125125
cd mariadb-sys-master/
126126
mysql -u root -p < ./sys_10.sql
127127

128-
Errors & solutions for performance schema
128+
Errors & solutions for performance schema installation
129129

130130
ERROR at line 21: Failed to open file './tables/sys_config_data_10.sql -- ported', error: 2
131131
Have a look at #452 solution given by @ericx

mysqltuner.pl

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,12 +1197,36 @@ sub get_log_file_real_path {
11971197
if ( -f "$file" ) {
11981198
return $file;
11991199
}
1200+
elsif ( -f "$hostname.log" ) {
1201+
return "$hostname.log";
1202+
}
12001203
elsif ( -f "$hostname.err" ) {
12011204
return "$hostname.err";
12021205
}
1203-
elsif ( $datadir ne "" ) {
1206+
elsif ( -f "$datadir$hostname.err" ) {
12041207
return "$datadir$hostname.err";
12051208
}
1209+
elsif ( -f "$datadir$hostname.log" ) {
1210+
return "$datadir$hostname.log";
1211+
}
1212+
elsif ( -f "$datadir"."mysql_error.log" ) {
1213+
return "$datadir"."mysql_error.log";
1214+
}
1215+
elsif ( -f "/var/log/mysql.log" ) {
1216+
return "/var/log/mysql.log";
1217+
}
1218+
elsif ( -f "/var/log/mysqld.log" ) {
1219+
return "/var/log/mysqld.log";
1220+
}
1221+
elsif ( -f "/var/log/mysql/$hostname.err" ) {
1222+
return "/var/log/mysql/$hostname.err";
1223+
}
1224+
elsif ( -f "/var/log/mysql/$hostname.log" ) {
1225+
return "/var/log/mysql/$hostname.log";
1226+
}
1227+
elsif ( -f "/var/log/mysql/"."mysql_error.log" ) {
1228+
return "/var/log/mysql/"."mysql_error.log";
1229+
}
12061230
else {
12071231
return $file;
12081232
}
@@ -1212,16 +1236,19 @@ sub log_file_recommendations {
12121236
$myvar{'log_error'} =
12131237
get_log_file_real_path( $myvar{'log_error'}, $myvar{'hostname'},
12141238
$myvar{'datadir'} );
1239+
12151240
subheaderprint "Log file Recommendations";
1216-
infoprint "Log file: "
1217-
. $myvar{'log_error'} . "("
1218-
. hr_bytes_rnd( ( stat $myvar{'log_error'} )[7] ) . ")";
12191241
if ( -f "$myvar{'log_error'}" ) {
12201242
goodprint "Log file $myvar{'log_error'} exists";
12211243
}
12221244
else {
12231245
badprint "Log file $myvar{'log_error'} doesn't exist";
1246+
return;
12241247
}
1248+
infoprint "Log file: "
1249+
. $myvar{'log_error'} . "("
1250+
. hr_bytes_rnd( ( stat $myvar{'log_error'} )[7] ) . ")";
1251+
12251252
if ( -r "$myvar{'log_error'}" ) {
12261253
goodprint "Log file $myvar{'log_error'} is readable.";
12271254
}

0 commit comments

Comments
 (0)