respect domain.writeerrorlog and domain.writeaccesslog when using log-to-pipe

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-04-03 14:34:20 +02:00
parent 11533c2d75
commit 3fbc9815ea

View File

@@ -772,21 +772,29 @@ class Apache extends HttpConfigBase
$logtype = 'vhost_combined'; $logtype = 'vhost_combined';
} }
if (Settings::Get('system.logfiles_piped') == '1' && Settings::Get('system.logfiles_script') != '') { if (Settings::Get('system.logfiles_piped') == '1' && Settings::Get('system.logfiles_script') != ''z) {
// replace for error_log if ($domain['writeerrorlog']) {
$command = \Froxlor\PhpHelper::replaceVariables(Settings::Get('system.logfiles_script'), array( // replace for error_log
'LOGFILE' => $error_log, $command = \Froxlor\PhpHelper::replaceVariables(Settings::Get('system.logfiles_script'), array(
'DOMAIN' => $domain['domain'], 'LOGFILE' => $error_log,
'CUSTOMER' => $domain['loginname'] 'DOMAIN' => $domain['domain'],
)); 'CUSTOMER' => $domain['loginname']
$logfiles_text .= ' ErrorLog "|' . $command . "\"\n"; ));
// replace for access_log $logfiles_text .= ' ErrorLog "|' . $command . "\"\n";
$command = \Froxlor\PhpHelper::replaceVariables(Settings::Get('system.logfiles_script'), array( } else {
'LOGFILE' => $access_log, $logfiles_text .= ' ErrorLog "' . $error_log . '"' . "\n";
'DOMAIN' => $domain['domain'], }
'CUSTOMER' => $domain['loginname'] if ($domain['writeaccesslog']) {
)); // replace for access_log
$logfiles_text .= ' CustomLog "|' . $command . '" ' . $logtype . "\n"; $command = \Froxlor\PhpHelper::replaceVariables(Settings::Get('system.logfiles_script'), array(
'LOGFILE' => $access_log,
'DOMAIN' => $domain['domain'],
'CUSTOMER' => $domain['loginname']
));
$logfiles_text .= ' CustomLog "|' . $command . '" ' . $logtype . "\n";
} else {
$logfiles_text .= ' CustomLog "' . $access_log . '" ' . $logtype . "\n";
}
} else { } else {
$logfiles_text .= ' ErrorLog "' . $error_log . '"' . "\n"; $logfiles_text .= ' ErrorLog "' . $error_log . '"' . "\n";
$logfiles_text .= ' CustomLog "' . $access_log . '" ' . $logtype . "\n"; $logfiles_text .= ' CustomLog "' . $access_log . '" ' . $logtype . "\n";