From 73c05fb2310be67be0dc59dfd5837188eeb758cc Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Tue, 12 Feb 2019 17:38:46 +0100 Subject: [PATCH] add setting for customzing webserver error-log level, fixes #650 Signed-off-by: Michael Kaufmann --- actions/admin/settings/130.webserver.php | 23 +++++++++++++++++++ actions/admin/settings/160.nameserver.php | 2 +- install/froxlor.sql | 3 ++- install/lib/class.FroxlorInstall.php | 1 + .../updates/froxlor/0.10/update_0.10.inc.php | 9 ++++++++ lib/Froxlor/Cron/Http/Apache.php | 2 ++ lib/Froxlor/Cron/Http/Nginx.php | 2 +- lib/Froxlor/Froxlor.php | 2 +- lng/english.lng.php | 2 ++ lng/german.lng.php | 2 ++ 10 files changed, 44 insertions(+), 4 deletions(-) diff --git a/actions/admin/settings/130.webserver.php b/actions/admin/settings/130.webserver.php index 6585a571..66d41047 100644 --- a/actions/admin/settings/130.webserver.php +++ b/actions/admin/settings/130.webserver.php @@ -191,6 +191,29 @@ return array( 'apache2' ) ), + 'system_errorlog_level' => array( + 'label' => $lng['serversettings']['errorlog_level'], + 'settinggroup' => 'system', + 'varname' => 'errorlog_level', + 'type' => 'option', + 'default' => (\Froxlor\Settings::Get('system.webserver') == 'nginx' ? 'error' : 'warn'), + 'option_mode' => 'one', + 'option_options' => array( + 'emerg' => 'emerg', + 'alert' => 'alert', + 'crit' => 'crit', + 'error' => 'error', + 'warn' => 'warn', + 'notice' => 'notice', + 'info' => 'info', + 'debug' => 'debug' + ), + 'save_method' => 'storeSettingField', + 'websrv_avail' => array( + 'apache2', + 'nginx' + ) + ), 'system_customersslpath' => array( 'label' => $lng['serversettings']['customerssl_directory'], 'settinggroup' => 'system', diff --git a/actions/admin/settings/160.nameserver.php b/actions/admin/settings/160.nameserver.php index 54ac6314..a7df3322 100644 --- a/actions/admin/settings/160.nameserver.php +++ b/actions/admin/settings/160.nameserver.php @@ -43,7 +43,7 @@ return array( 'settinggroup' => 'system', 'varname' => 'dns_server', 'type' => 'option', - 'default' => 'bind', + 'default' => 'Bind', 'option_mode' => 'one', 'option_options' => array( 'Bind' => 'Bind9', diff --git a/install/froxlor.sql b/install/froxlor.sql index 8c958416..ce910543 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -643,6 +643,7 @@ opcache.interned_strings_buffer'), ('system', 'logfiles_piped', '0'), ('system', 'logfiles_script', ''), ('system', 'dhparams_file', ''), + ('system', 'errorlog_level', 'warn'), ('api', 'enabled', '0'), ('2fa', 'enabled', '1'), ('panel', 'decimal_places', '4'), @@ -678,7 +679,7 @@ opcache.interned_strings_buffer'), ('panel', 'customer_hide_options', ''), ('panel', 'is_configured', '0'), ('panel', 'version', '0.10.0'), - ('panel', 'db_version', '201812190'); + ('panel', 'db_version', '201901120'); DROP TABLE IF EXISTS `panel_tasks`; diff --git a/install/lib/class.FroxlorInstall.php b/install/lib/class.FroxlorInstall.php index 34a1bbd5..0c266d5b 100644 --- a/install/lib/class.FroxlorInstall.php +++ b/install/lib/class.FroxlorInstall.php @@ -493,6 +493,7 @@ class FroxlorInstall $this->_updateSetting($upd_stmt, '/etc/init.d/nginx reload', 'system', 'apachereload_command'); $this->_updateSetting($upd_stmt, '/etc/nginx/nginx.pem', 'system', 'ssl_cert_file'); $this->_updateSetting($upd_stmt, '/var/run/', 'phpfpm', 'fastcgi_ipcdir'); + $this->_updateSetting($upd_stmt, 'error', 'system', 'errorlog_level'); } $this->_updateSetting($upd_stmt, $this->_data['activate_newsfeed'], 'admin', 'show_news_feed'); diff --git a/install/updates/froxlor/0.10/update_0.10.inc.php b/install/updates/froxlor/0.10/update_0.10.inc.php index 919dcd05..1c2aa047 100644 --- a/install/updates/froxlor/0.10/update_0.10.inc.php +++ b/install/updates/froxlor/0.10/update_0.10.inc.php @@ -187,3 +187,12 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201812180')) { \Froxlor\Froxlor::updateToDbVersion('201812190'); } + +if (\Froxlor\Froxlor::isDatabaseVersion('201812190')) { + + showUpdateStep("Adding new webserver error-log-level setting"); + Settings::AddNew('system.errorlog_level', (\Froxlor\Settings::Get('system.webserver') == 'nginx' ? 'error' : 'warn')); + lastStepStatus(0); + + \Froxlor\Froxlor::updateToDbVersion('201901120'); +} diff --git a/lib/Froxlor/Cron/Http/Apache.php b/lib/Froxlor/Cron/Http/Apache.php index 4d214b60..3d70364f 100644 --- a/lib/Froxlor/Cron/Http/Apache.php +++ b/lib/Froxlor/Cron/Http/Apache.php @@ -737,6 +737,8 @@ class Apache extends HttpConfigBase touch($error_log); chown($error_log, Settings::Get('system.httpuser')); chgrp($error_log, Settings::Get('system.httpgroup')); + // set error log log-level + $logfiles_text .= ' LogLevel ' . \Froxlor\Settings::Get('system.errorlog_level'); } else { $error_log = '/dev/null'; } diff --git a/lib/Froxlor/Cron/Http/Nginx.php b/lib/Froxlor/Cron/Http/Nginx.php index aa4ca1bd..a2f10b27 100644 --- a/lib/Froxlor/Cron/Http/Nginx.php +++ b/lib/Froxlor/Cron/Http/Nginx.php @@ -1050,7 +1050,7 @@ class Nginx extends HttpConfigBase } $logfiles_text .= "\t" . 'access_log ' . $access_log . ' ' . $logtype . ';' . "\n"; - $logfiles_text .= "\t" . 'error_log ' . $error_log . ' error;' . "\n"; + $logfiles_text .= "\t" . 'error_log ' . $error_log . ' ' . \Froxlor\Settings::Get('system.errorlog_level') . ';' . "\n"; if (Settings::Get('system.awstats_enabled') == '1') { if ((int) $domain['parentdomainid'] == 0) { diff --git a/lib/Froxlor/Froxlor.php b/lib/Froxlor/Froxlor.php index 56f5e5b4..cac0f2f7 100644 --- a/lib/Froxlor/Froxlor.php +++ b/lib/Froxlor/Froxlor.php @@ -10,7 +10,7 @@ final class Froxlor const VERSION = '0.10.0'; // Database version (YYYYMMDDC where C is a daily counter) - const DBVERSION = '201812190'; + const DBVERSION = '201901120'; // Distribution branding-tag (used for Debian etc.) const BRANDING = ''; diff --git a/lng/english.lng.php b/lng/english.lng.php index 58b2f14a..e9fe8534 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -2052,3 +2052,5 @@ $lng['panel']['settings_before_configuration'] = 'Please be sure you adjusted th $lng['panel']['alternative_cmdline_config'] = 'Alternatively, just run the following command as root-user in your shell to configure the services automatically'; $lng['tasks']['remove_pdns_domain'] = 'Delete domain %s from PowerDNS database'; $lng['admin']['novhostcontainer'] = '

None of the IPs and ports has the "' . $lng['admin']['ipsandports']['create_vhostcontainer'] . '" option enabled, many settings here will not be available'; +$lng['serversettings']['errorlog_level']['title'] = 'Error log-level'; +$lng['serversettings']['errorlog_level']['description'] = 'Specify the error log level. Default is "warn" for apache-users and "error" for nginx-users.'; diff --git a/lng/german.lng.php b/lng/german.lng.php index 4702e3bc..58600e33 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1699,3 +1699,5 @@ $lng['panel']['settings_before_configuration'] = 'Stelle sicher, dass die Einste $lng['panel']['alternative_cmdline_config'] = 'Alternativ, führe den folgenden Befehl als root-Benutzer auf der Shell aus, um die Dienste automatisch zu konfigurieren.'; $lng['tasks']['remove_pdns_domain'] = 'Lösche Domain %s von PowerDNS Datenbank'; $lng['admin']['novhostcontainer'] = '

Keine der IPs und Ports hat die Option "' . $lng['admin']['ipsandports']['create_vhostcontainer'] . '" aktiviert, einige Einstellungen sind daher nicht verfügbar.'; +$lng['serversettings']['errorlog_level']['title'] = 'Ausführlichkeit des Fehlerprotokolls'; +$lng['serversettings']['errorlog_level']['description'] = 'Steuert die Ausführlichkeit des Fehlerprotokolls. Voreinstellung ist "warn" bei Apache und "error" bei Nginx.';