From e3a91ece0034b20a70a3c8c562827cc6fae40833 Mon Sep 17 00:00:00 2001 From: KiekerJan Date: Thu, 8 Sep 2022 22:23:07 +0200 Subject: [PATCH] move nextcloud logging to syslog --- conf/logrotate/mailinabox | 1 + conf/rsyslog/20-nextcloud.conf | 4 ++++ setup/additionals.sh | 3 +++ setup/nextcloud.sh | 2 ++ 4 files changed, 10 insertions(+) create mode 100644 conf/rsyslog/20-nextcloud.conf diff --git a/conf/logrotate/mailinabox b/conf/logrotate/mailinabox index 6b629de1..ed5fd34a 100644 --- a/conf/logrotate/mailinabox +++ b/conf/logrotate/mailinabox @@ -1,5 +1,6 @@ /var/log/roundcubemail/errors.log /var/log/roundcubemail/sendmail.log +/var/log/nextcloud.log { rotate 4 weekly diff --git a/conf/rsyslog/20-nextcloud.conf b/conf/rsyslog/20-nextcloud.conf new file mode 100644 index 00000000..7a39ff7c --- /dev/null +++ b/conf/rsyslog/20-nextcloud.conf @@ -0,0 +1,4 @@ +:syslogtag, startswith, "Nextcloud" -/var/log/nextcloud.log + +# Stop logging +& stop \ No newline at end of file diff --git a/setup/additionals.sh b/setup/additionals.sh index f1b87e4e..1c4d07e9 100644 --- a/setup/additionals.sh +++ b/setup/additionals.sh @@ -13,6 +13,9 @@ sed -i "s/\*\.\*;auth,authpriv.none.*\-\/var\/log\/syslog/\*\.\*;mail,auth,authp # Reduce logs by only logging ufw in ufw.log sed -i "s/#\& stop/\& stop/g" /etc/rsyslog.d/20-ufw.conf +# Add nextcloud logging +hide_output install -m 644 conf/rsyslog/20-nextcloud.conf /etc/rsyslog.d/ + restart_service rsyslog # Create forward for root emails diff --git a/setup/nextcloud.sh b/setup/nextcloud.sh index fbc98935..d1f5eefe 100755 --- a/setup/nextcloud.sh +++ b/setup/nextcloud.sh @@ -334,6 +334,8 @@ include("$STORAGE_ROOT/owncloud/config.php"); \$CONFIG['logtimezone'] = '$TIMEZONE'; \$CONFIG['logdateformat'] = 'Y-m-d H:i:s'; +\$CONFIG['log_type'] = 'syslog', +\$CONFIG['syslog_tag'] = 'Nextcloud', \$CONFIG['mail_domain'] = '$PRIMARY_HOSTNAME';