mirror of
https://github.com/webmin/webmin.git
synced 2025-07-20 16:48:46 +00:00
Recognize MariaDB log file from config
This commit is contained in:
@ -6,26 +6,48 @@ require 'mysql-lib.pl';
|
||||
# Returns a list of structures containing extra log files known to this module
|
||||
sub syslog_getlogs
|
||||
{
|
||||
local $conf = &get_mysql_config();
|
||||
local ($sect) = grep { $_->{'name'} eq 'mysqld_safe' ||
|
||||
$_->{'name'} eq 'safe_mysqld' } @$conf;
|
||||
local @rv;
|
||||
if ($sect) {
|
||||
local $log = &find_value("err-log", $sect->{'members'});
|
||||
if ($log) {
|
||||
push(@rv, { 'file' => $log,
|
||||
'desc' => $text{'syslog_desc'},
|
||||
'active' => 1,
|
||||
} );
|
||||
}
|
||||
local $log = &find_value("log", $sect->{'members'});
|
||||
if ($log) {
|
||||
push(@rv, { 'file' => $log,
|
||||
'desc' => $text{'syslog_logdesc'},
|
||||
'active' => 1,
|
||||
} );
|
||||
my $conf = &get_mysql_config();
|
||||
my ($mysqld) = grep { $_->{'name'} eq 'mysqld_safe' ||
|
||||
$_->{'name'} eq 'safe_mysqld' } @$conf;
|
||||
my ($mariadb) = grep { $_->{'name'} eq 'mariadb' } @$conf;
|
||||
my @rv;
|
||||
|
||||
# Find the error log
|
||||
my $log;
|
||||
if ($mysqld) {
|
||||
$log = &find_value("err-log", $mysqld->{'members'});
|
||||
}
|
||||
if ($mariadb && !$log) {
|
||||
$log = &find_value("log_error", $mariadb->{'members'});
|
||||
if ($log !~ /^\//) {
|
||||
my $datadir = $mysqld ?
|
||||
&find_value("datadir", $mysqld->{'members'}) : undef;
|
||||
if ($datadir) {
|
||||
$log = $datadir."/".$log;
|
||||
}
|
||||
else {
|
||||
$log = undef;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($log) {
|
||||
push(@rv, { 'file' => $log,
|
||||
'desc' => $text{'syslog_desc'},
|
||||
'active' => 1,
|
||||
} );
|
||||
}
|
||||
|
||||
# Find the query log
|
||||
my $qlog;
|
||||
if ($mysqld) {
|
||||
$qlog = &find_value("log", $mysqld->{'members'});
|
||||
}
|
||||
if ($qlog) {
|
||||
push(@rv, { 'file' => $qlog,
|
||||
'desc' => $text{'syslog_logdesc'},
|
||||
'active' => 1,
|
||||
} );
|
||||
}
|
||||
return @rv;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user