Skip to content

Commit c3da0b0

Browse files
committed
add server-log option for explict server log
This allows a user to specify a logrotated file or another file that isn't discoverable from server log_error system variable or other defaults. close #504
1 parent 8cda55a commit c3da0b0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

mysqltuner.pl

+7-2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ package main;
8888
"noprocess" => 0,
8989
"dbstat" => 0,
9090
"nodbstat" => 0,
91+
"server-log" => '',
9192
"tbstat" => 0,
9293
"notbstat" => 0,
9394
"idxstat" => 0,
@@ -133,6 +134,7 @@ package main;
133134
'sysstat', 'nosysstat',
134135
'pfstat', 'nopfstat',
135136
'idxstat', 'noidxstat',
137+
'server-log=s',
136138
)
137139
or pod2usage(
138140
-exitval => 1,
@@ -1242,7 +1244,7 @@ sub get_log_file_real_path {
12421244
}
12431245

12441246
sub log_file_recommendations {
1245-
$myvar{'log_error'} =
1247+
$myvar{'log_error'} = $opt{'server-log'} ||
12461248
get_log_file_real_path( $myvar{'log_error'}, $myvar{'hostname'},
12471249
$myvar{'datadir'} );
12481250

@@ -1273,7 +1275,9 @@ sub log_file_recommendations {
12731275
goodprint "Log file $myvar{'log_error'} is not empty";
12741276
}
12751277
else {
1276-
badprint "Log file $myvar{'log_error'} is empty";
1278+
infoprint
1279+
"Log file $myvar{'log_error'} is empty. Assuming log-rotation. Use --server-log={file} for explicit file";
1280+
return;
12771281
}
12781282

12791283
if ( ( stat $myvar{'log_error'} )[7] < 32 * 1024 * 1024 ) {
@@ -6428,6 +6432,7 @@ =head1 CONNECTION AND AUTHENTICATION
64286432
--mysqladmin <path> Path to a custom mysqladmin executable
64296433
--mysqlcmd <path> Path to a custom mysql executable
64306434
--defaults-file <path> Path to a custom .my.cnf
6435+
--server-log <path> Path to explict log file
64316436
64326437
=head1 PERFORMANCE AND REPORTING OPTIONS
64336438

0 commit comments

Comments
 (0)