I've got a lot of that type of errors in my nextcloud logs: (it seems like I have already so many errors in my log, that it tries to create a new file, named nextcloud.log.1)
rename(/var/log/nextcloud/nextcloud.log,/var/log/nextcloud/nextcloud.log.1): Permission denied at /var/www/nextcloud/lib/public/Log/RotationTrait.php#53
I think this is becaue you just chown nextcloud.log but not the complete folder in the script https://github.com/nextcloud/vm/blob/master/static/setup_secure_permissions_nextcloud.sh
chown -R "${htuser}":"${htgroup}" "${VMLOGS}"
should solve these errors.
But I don't know if that brings any security issues with it.
this should probably then also get adjusted in the https://github.com/nextcloud/vm/blob/master/apps/fail2ban.sh script
There are no harm in setting the folder to www-data:www-data, I can prepare a PR for that later.
So I would say this issue is already solved? I have manually changed the owner of the folder to www-data:www-data and directly all error messages were gone.
Thanks for closing.
Sorry, I have the same error messages very often and I'm still quite a beginner with nextcloud.
Can you give me the exact code to solve this? And after this, is it necessary to change the ...fail2ban.sh-script ir is this done via updates in the meantime?
I have Nextcloud 19 on a VM (image by enoch 85 downloaded last year...).
Thanks in advance!
@Klemens2
The permissions are already set: https://github.com/nextcloud/vm/blob/master/static/setup_secure_permissions_nextcloud.sh#L54
Please run sudo bash /var/scripts/setup_secure_permissions_nextcloud.shto fix the issue.
Thank you very much, Daniel!!!
I did this step and it ran as shown in the following snapshot. But unfortunatly, the error is still resuming, every five minutes...

Have you another idea what to do?
@Klemens2 sudo chown -R www-data:www-data /var/log/nextcloud
Thank you, it worked :-)
@Klemens2 Can you please test the latest script?
wget https://raw.githubusercontent.com/nextcloud/vm/master/static/setup_secure_permissions_nextcloud.sh && sudo bash setup_secure_permissions_nextcloud.sh
Also, please give me the output of sudo ls -l /var/log/nextcloud
Thanks!
Sorry for my late reply, I've been on vacation until now.
1)

2)

Thank you!