Is it writable for the www user? The default option is in the data directory, and I find it probable that it will use the default location if it can’t write to the file.
hm it does not really work. After accessing nextcloud, the rights of the file are changed back again. And The file is then created again on data share and It is somehow written in both files.
root@71c47463ccf4:/# ls -la /config/log/nextcloud.log
-rwxrw---- 1 abc abc 0 Jun 22 20:19 /config/log/nextcloud.log
root@71c47463ccf4:/# ls -la /config/log/nextcloud.log
-rw-r----- 1 abc abc 831 Jun 22 20:22 /config/log/nextcloud.log
root@71c47463ccf4:/#
root@71c47463ccf4:/# ls -la /data/nextcloud.log
-rw-r----- 1 abc abc 29999 Jun 22 21:13 /data/nextcloud.log
root@71c47463ccf4:/# ls -la /config/log/nextcloud.log
-rw-r----- 1 abc abc 24495 Jun 22 21:10 /config/log/nextcloud.log
root@71c47463ccf4:/#
Not sure why it is happens. Personally I use default log place under data folder. Then just made a link to the file from my common log folder to the log file in nextcloud data folder: ln -s /pathToLog/nextcloud.log /pathToNC/data/nextcloud.log
Then adjust log rotation script to recreate it with my web user and 640 rights:
# cat /etc/logrotate.d/nextcloud.log.conf
/pathToNC/data/nextcloud.log /pathToNC/data/audit.log {
compress
minsize 5242880 #not rotate till around 5MB
notifempty
size 5242880 #not rotate till around 5MB
olddir /var/log
daily
}
In this case in your log folder you will see something like this:
ls -la /pathToLog/nextcloud.*
lrwxrwxrwx 1 root root 33 Jun 4 15:37 /pathToLog/nextcloud.log -> /pathToNC/data/nextcloud.log
-rw-r----- 1 webuser webuser 1279203 Jun 21 06:00 /pathToLog/nextcloud.log.1.gz
-rw-r----- 1 webuser webuser 1252732 Jun 14 06:00 /pathToLog/nextcloud.log.2.gz
-rw-r----- 1 webuser webuser 6131822 Jun 12 06:00 /pathToLog/nextcloud.log.3.gz
-rw-r----- 1 webuser webuser 3047081 Jun 11 06:00 /pathToLog/nextcloud.log.4.gz
-rw-r----- 1 webuser webuser 3664280 Jun 10 06:00 /pathToLog/nextcloud.log.5.gz
-rw-r----- 1 webuser webuser 3050432 Jun 9 06:00 /pathToLog/nextcloud.log.6.gz
-rw-r----- 1 webuser webuser 7323984 Jun 8 06:00 /pathToLog/nextcloud.log.7.gz
-rw-r----- 1 webuser webuser 9165402 Jun 7 06:00 /pathToLog/nextcloud.log.8.gz