Prevent log size from being too large, which breaks clog. Fixes #9081

This commit is contained in:
jim-p 2018-11-05 15:11:23 -05:00
parent 4c4e294b0f
commit 8bd36425b4
3 changed files with 5 additions and 0 deletions

View File

@ -870,6 +870,7 @@ function clear_log_file($logfile = "/var/log/system.log", $restart_syslogd = tru
touch($logfile);
} else {
$log_size = isset($config['syslog']['logfilesize']) ? $config['syslog']['logfilesize'] : "511488";
$log_size = ($log_size < (2**32)/2) ? $log_size : "511488";
$log_size = isset($config['syslog'][basename($logfile, '.log') . '_settings']['logfilesize']) ? $config['syslog'][basename($logfile, '.log') . '_settings']['logfilesize'] : $log_size;
exec("/usr/local/sbin/clog -i -s {$log_size} " . escapeshellarg($logfile));
}

View File

@ -649,6 +649,8 @@ function manage_log_code() {
if (isset($logfilesize) && (strlen($logfilesize) > 0)) {
if (!is_numeric($logfilesize) || ($logfilesize < 100000)) {
$input_errors[] = gettext("Log file size must be numeric and greater than or equal to 100000.");
} elseif ($logfilesize >= (2**32)/2) {
$input_errors[] = gettext("Log file size is too large. Set a smaller value.");
}
}

View File

@ -103,6 +103,8 @@ if ($_POST['resetlogs'] == gettext("Reset Log Files")) {
if (isset($_POST['logfilesize']) && (strlen($_POST['logfilesize']) > 0)) {
if (!is_numeric($_POST['logfilesize']) || ($_POST['logfilesize'] < 100000)) {
$input_errors[] = gettext("Log file size must be numeric and greater than or equal to 100000.");
} elseif ($_POST['logfilesize'] >= (2**32)/2) {
$input_errors[] = gettext("Log file size is too large. Set a smaller value.");
}
}
if (!$input_errors) {