summaryrefslogtreecommitdiffstats
path: root/apps/admin_audit
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-01-19 16:16:09 +0100
committerJoas Schilling <coding@schilljs.com>2022-01-20 10:07:57 +0100
commit497c5841fc60b587dba84dd9ea14e4cccee656fd (patch)
tree3be0551bf473dad8bb0c4906473b1d479cd4d079 /apps/admin_audit
parent4c41abd8169e78aa35bd6ea9bd9eda6d76817085 (diff)
downloadnextcloud-server-497c5841fc60b587dba84dd9ea14e4cccee656fd.tar.gz
nextcloud-server-497c5841fc60b587dba84dd9ea14e4cccee656fd.zip
Allow write audit log to syslog and systemdlog
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/admin_audit')
-rw-r--r--apps/admin_audit/lib/AppInfo/Application.php18
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);
}
/**