diff options
author | Joas Schilling <coding@schilljs.com> | 2022-01-19 16:16:09 +0100 |
---|---|---|
committer | Vincent Petry (Rebase PR Action) <PVince81@users.noreply.github.com> | 2022-02-16 13:52:21 +0000 |
commit | c612ae78d7e49e2c653fe961b33e57a4d09a2e71 (patch) | |
tree | a562604172a21ff394616fca3d9842a480072346 /apps | |
parent | 3f42547b0155d0cd7234505c89e54b121f41ac34 (diff) | |
download | nextcloud-server-c612ae78d7e49e2c653fe961b33e57a4d09a2e71.tar.gz nextcloud-server-c612ae78d7e49e2c653fe961b33e57a4d09a2e71.zip |
Allow write audit log to syslog and systemdlog
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/admin_audit/lib/AppInfo/Application.php | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/apps/admin_audit/lib/AppInfo/Application.php b/apps/admin_audit/lib/AppInfo/Application.php index 7b5fb520bc9..594e1c7f2c4 100644 --- a/apps/admin_audit/lib/AppInfo/Application.php +++ b/apps/admin_audit/lib/AppInfo/Application.php @@ -96,15 +96,19 @@ class Application extends App implements IBootstrap { } private function getLogger(IConfig $config, - LoggerInterface $logger, ILogFactory $logFactory): LoggerInterface { - $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log'; - $logFile = $config->getAppValue('admin_audit', 'logfile', $default); - - if ($logFile === null) { - return $logger; + $auditType = $config->getSystemValueString('log_type_audit', 'file'); + $defaultTag = $config->getSystemValueString('syslog_tag', 'Nextcloud'); + $auditTag = $config->getSystemValueString('syslog_tag_audit', $defaultTag); + $logFile = $config->getSystemValueString('logfile_audit', ''); + + if ($auditType === 'file' && !$logFile) { + $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log'; + // Legacy way was appconfig, now it's paralleled with the normal log config + $logFile = $config->getAppValue('admin_audit', 'logfile', $default); } - return $logFactory->getCustomPsrLogger($logFile); + + return $logFactory->getCustomPsrLogger($logFile, $auditType, $auditTag); } /** |