mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Prevent log size from being too large, which breaks clog. Fixes #9081
This commit is contained in:
parent
4c4e294b0f
commit
8bd36425b4
@ -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));
|
||||
}
|
||||
|
||||
@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user