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
This commit is contained in:
Daniel Black 2021-01-30 10:23:56 +11:00
parent 8cda55aa60
commit c3da0b013c

View file

@ -88,6 +88,7 @@ my %opt = (
"noprocess" => 0, "noprocess" => 0,
"dbstat" => 0, "dbstat" => 0,
"nodbstat" => 0, "nodbstat" => 0,
"server-log" => '',
"tbstat" => 0, "tbstat" => 0,
"notbstat" => 0, "notbstat" => 0,
"idxstat" => 0, "idxstat" => 0,
@ -133,6 +134,7 @@ GetOptions(
'sysstat', 'nosysstat', 'sysstat', 'nosysstat',
'pfstat', 'nopfstat', 'pfstat', 'nopfstat',
'idxstat', 'noidxstat', 'idxstat', 'noidxstat',
'server-log=s',
) )
or pod2usage( or pod2usage(
-exitval => 1, -exitval => 1,
@ -1242,7 +1244,7 @@ sub get_log_file_real_path {
} }
sub log_file_recommendations { sub log_file_recommendations {
$myvar{'log_error'} = $myvar{'log_error'} = $opt{'server-log'} ||
get_log_file_real_path( $myvar{'log_error'}, $myvar{'hostname'}, get_log_file_real_path( $myvar{'log_error'}, $myvar{'hostname'},
$myvar{'datadir'} ); $myvar{'datadir'} );
@ -1273,7 +1275,9 @@ sub log_file_recommendations {
goodprint "Log file $myvar{'log_error'} is not empty"; goodprint "Log file $myvar{'log_error'} is not empty";
} }
else { 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 ) { if ( ( stat $myvar{'log_error'} )[7] < 32 * 1024 * 1024 ) {
@ -6428,6 +6432,7 @@ You must provide the remote server's total memory when connecting to other serve
--mysqladmin <path> Path to a custom mysqladmin executable --mysqladmin <path> Path to a custom mysqladmin executable
--mysqlcmd <path> Path to a custom mysql executable --mysqlcmd <path> Path to a custom mysql executable
--defaults-file <path> Path to a custom .my.cnf --defaults-file <path> Path to a custom .my.cnf
--server-log <path> Path to explict log file
=head1 PERFORMANCE AND REPORTING OPTIONS =head1 PERFORMANCE AND REPORTING OPTIONS