$_ BSDHowTo.ch
How To... Why not..? Scripts Patches RSS logo

How to make Nextcloud use syslogd(8)

Last modified: 2018-12-18

Introduction

In this post I show you how you can configure Nextcloud to use syslogd(8) instead of its default log file /var/www/nextcloud/data/nextcloud.log.

Use mfs for the win

You probably already have setup the random(4) device for Nextcloud as described here. Check that your fstab(5) contains the following line:

swap /var/www/dev rw,-s=1048576 0 0

This creates a small 1 MB memory file system and mounts it to /var/www/dev during system startup. This FS has the advantage that it is mounted without the nodev flag that is used on /var.

If you don't want to reboot your system you can create and mount the new file system manually:

$ doas mount_mfs -s 1M /dev/sd0b /var/www/dev

Configuration of syslogd(8)

The [syslogd(8)] daemon must create an additional log socket in the chroot(2) of the web server. Make sure this is done during system startup:

$ doas rcctl set syslogd flags -a /var/www/dev/log

If you don't want to reboot your system you can just restart syslogd(8):

$ doas rcctl restart syslogd

Configuration of Nextcloud

Edit the configuration file of Nextcloud and add the two following entries to use syslog:

'log_type' => 'syslog',
'logfile' => '',

The configuration file is /var/www/nextcloud/config/config.php.