mirror of
https://github.com/nextcloud/server.git
synced 2026-04-02 15:45:38 -04:00
Allow write audit log to syslog and systemdlog
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
4c41abd816
commit
497c5841fc
2 changed files with 36 additions and 7 deletions
|
|
@ -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);
|
||||
$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 ($logFile === null) {
|
||||
return $logger;
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -839,6 +839,13 @@ $CONFIG = [
|
|||
*/
|
||||
'log_type' => 'file',
|
||||
|
||||
/**
|
||||
* This parameter determines where the audit logs are sent. See ``log_type`` for more information.
|
||||
*
|
||||
* Defaults to ``file``
|
||||
*/
|
||||
'log_type_audit' => 'file',
|
||||
|
||||
/**
|
||||
* Name of the file to which the Nextcloud logs are written if parameter
|
||||
* ``log_type`` is set to ``file``.
|
||||
|
|
@ -848,7 +855,15 @@ $CONFIG = [
|
|||
'logfile' => '/var/log/nextcloud.log',
|
||||
|
||||
/**
|
||||
* Log file mode for the Nextcloud loggin type in octal notation.
|
||||
* Name of the file to which the audit logs are written if parameter
|
||||
* ``log_type`` is set to ``file``.
|
||||
*
|
||||
* Defaults to ``[datadirectory]/audit.log``
|
||||
*/
|
||||
'logfile_audit' => '/var/log/audit.log',
|
||||
|
||||
/**
|
||||
* Log file mode for the Nextcloud logging type in octal notation.
|
||||
*
|
||||
* Defaults to 0640 (writeable by user, readable by group).
|
||||
*/
|
||||
|
|
@ -872,6 +887,16 @@ $CONFIG = [
|
|||
*/
|
||||
'syslog_tag' => 'Nextcloud',
|
||||
|
||||
/**
|
||||
* If you maintain different instances and aggregate the logs, you may want
|
||||
* to distinguish between them. ``syslog_tag_audit`` can be set per instance
|
||||
* with a unique id. Only available if ``log_type`` is set to ``syslog`` or
|
||||
* ``systemd``.
|
||||
*
|
||||
* The default value is the value of ``syslog_tag``.
|
||||
*/
|
||||
'syslog_tag_audit' => 'Nextcloud',
|
||||
|
||||
/**
|
||||
* Log condition for log level increase based on conditions. Once one of these
|
||||
* conditions is met, the required log level is set to debug. This allows to
|
||||
|
|
|
|||
Loading…
Reference in a new issue