add setting for customzing webserver error-log level, fixes #650

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2019-02-12 17:38:46 +01:00
parent d0fb77f3e9
commit 73c05fb231
10 changed files with 44 additions and 4 deletions

View File

@@ -191,6 +191,29 @@ return array(
'apache2' '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( 'system_customersslpath' => array(
'label' => $lng['serversettings']['customerssl_directory'], 'label' => $lng['serversettings']['customerssl_directory'],
'settinggroup' => 'system', 'settinggroup' => 'system',

View File

@@ -43,7 +43,7 @@ return array(
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'dns_server', 'varname' => 'dns_server',
'type' => 'option', 'type' => 'option',
'default' => 'bind', 'default' => 'Bind',
'option_mode' => 'one', 'option_mode' => 'one',
'option_options' => array( 'option_options' => array(
'Bind' => 'Bind9', 'Bind' => 'Bind9',

View File

@@ -643,6 +643,7 @@ opcache.interned_strings_buffer'),
('system', 'logfiles_piped', '0'), ('system', 'logfiles_piped', '0'),
('system', 'logfiles_script', ''), ('system', 'logfiles_script', ''),
('system', 'dhparams_file', ''), ('system', 'dhparams_file', ''),
('system', 'errorlog_level', 'warn'),
('api', 'enabled', '0'), ('api', 'enabled', '0'),
('2fa', 'enabled', '1'), ('2fa', 'enabled', '1'),
('panel', 'decimal_places', '4'), ('panel', 'decimal_places', '4'),
@@ -678,7 +679,7 @@ opcache.interned_strings_buffer'),
('panel', 'customer_hide_options', ''), ('panel', 'customer_hide_options', ''),
('panel', 'is_configured', '0'), ('panel', 'is_configured', '0'),
('panel', 'version', '0.10.0'), ('panel', 'version', '0.10.0'),
('panel', 'db_version', '201812190'); ('panel', 'db_version', '201901120');
DROP TABLE IF EXISTS `panel_tasks`; DROP TABLE IF EXISTS `panel_tasks`;

View File

@@ -493,6 +493,7 @@ class FroxlorInstall
$this->_updateSetting($upd_stmt, '/etc/init.d/nginx reload', 'system', 'apachereload_command'); $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, '/etc/nginx/nginx.pem', 'system', 'ssl_cert_file');
$this->_updateSetting($upd_stmt, '/var/run/', 'phpfpm', 'fastcgi_ipcdir'); $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'); $this->_updateSetting($upd_stmt, $this->_data['activate_newsfeed'], 'admin', 'show_news_feed');

View File

@@ -187,3 +187,12 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201812180')) {
\Froxlor\Froxlor::updateToDbVersion('201812190'); \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');
}

View File

@@ -737,6 +737,8 @@ class Apache extends HttpConfigBase
touch($error_log); touch($error_log);
chown($error_log, Settings::Get('system.httpuser')); chown($error_log, Settings::Get('system.httpuser'));
chgrp($error_log, Settings::Get('system.httpgroup')); chgrp($error_log, Settings::Get('system.httpgroup'));
// set error log log-level
$logfiles_text .= ' LogLevel ' . \Froxlor\Settings::Get('system.errorlog_level');
} else { } else {
$error_log = '/dev/null'; $error_log = '/dev/null';
} }

View File

@@ -1050,7 +1050,7 @@ class Nginx extends HttpConfigBase
} }
$logfiles_text .= "\t" . 'access_log ' . $access_log . ' ' . $logtype . ';' . "\n"; $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 (Settings::Get('system.awstats_enabled') == '1') {
if ((int) $domain['parentdomainid'] == 0) { if ((int) $domain['parentdomainid'] == 0) {

View File

@@ -10,7 +10,7 @@ final class Froxlor
const VERSION = '0.10.0'; const VERSION = '0.10.0';
// Database version (YYYYMMDDC where C is a daily counter) // Database version (YYYYMMDDC where C is a daily counter)
const DBVERSION = '201812190'; const DBVERSION = '201901120';
// Distribution branding-tag (used for Debian etc.) // Distribution branding-tag (used for Debian etc.)
const BRANDING = ''; const BRANDING = '';

View File

@@ -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['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['tasks']['remove_pdns_domain'] = 'Delete domain %s from PowerDNS database';
$lng['admin']['novhostcontainer'] = '<br><br><small class="red">None of the IPs and ports has the "' . $lng['admin']['ipsandports']['create_vhostcontainer'] . '" option enabled, many settings here will not be available</small>'; $lng['admin']['novhostcontainer'] = '<br><br><small class="red">None of the IPs and ports has the "' . $lng['admin']['ipsandports']['create_vhostcontainer'] . '" option enabled, many settings here will not be available</small>';
$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.';

View File

@@ -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['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['tasks']['remove_pdns_domain'] = 'Lösche Domain %s von PowerDNS Datenbank';
$lng['admin']['novhostcontainer'] = '<br><br><small class="red">Keine der IPs und Ports hat die Option "' . $lng['admin']['ipsandports']['create_vhostcontainer'] . '" aktiviert, einige Einstellungen sind daher nicht verfügbar.</small>'; $lng['admin']['novhostcontainer'] = '<br><br><small class="red">Keine der IPs und Ports hat die Option "' . $lng['admin']['ipsandports']['create_vhostcontainer'] . '" aktiviert, einige Einstellungen sind daher nicht verfügbar.</small>';
$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.';