Skip to content

Commit

Permalink
add server-log option for explict server log
Browse files Browse the repository at this point in the history
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
  • Loading branch information
grooverdan committed Jan 29, 2021
1 parent 8cda55a commit c3da0b0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mysqltuner.pl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ package main;
"noprocess" => 0,
"dbstat" => 0,
"nodbstat" => 0,
"server-log" => '',
"tbstat" => 0,
"notbstat" => 0,
"idxstat" => 0,
Expand Down Expand Up @@ -133,6 +134,7 @@ package main;
'sysstat', 'nosysstat',
'pfstat', 'nopfstat',
'idxstat', 'noidxstat',
'server-log=s',
)
or pod2usage(
-exitval => 1,
Expand Down Expand Up @@ -1242,7 +1244,7 @@ sub get_log_file_real_path {
}

sub log_file_recommendations {
$myvar{'log_error'} =
$myvar{'log_error'} = $opt{'server-log'} ||
get_log_file_real_path( $myvar{'log_error'}, $myvar{'hostname'},
$myvar{'datadir'} );

Expand Down Expand Up @@ -1273,7 +1275,9 @@ sub log_file_recommendations {
goodprint "Log file $myvar{'log_error'} is not empty";
}
else {
badprint "Log file $myvar{'log_error'} is empty";
infoprint
"Log file $myvar{'log_error'} is empty. Assuming log-rotation. Use --server-log={file} for explicit file";
return;
}

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

0 comments on commit c3da0b0

Please sign in to comment.