Logfile does not rotate

Hello,
i have a little problem with the logfile. It does not rotate.
It’s nextcloud 13.0.1 on Ubuntu 16.04 with apache webserver.

config.php:
‘loglevel’ => 2,
‘logfile’ => ‘/daten/nextcloud.log’,
‘log_rotate_size’ => 10485760,

ll /daten/nextcl*:
-rw-r----- 1 www-data www-data 38267770 Mär 22 08:39 nextcloud.log

What ist wrong?

I don’t have a logfile variable in my config array, maybe that’s it?

Thank you for your hint, but it’s the same problem with ‘logfile’ variable and without it. I put it in the config.php to test if it the reason for that.

I believe your logfile is located at ‘/daten/nextcl*/nextcloud.log’ not ‘/daten/nextcloud.log’

NOTE: Replace the asterisk with the right characters.

The logfile ist located at /daten/nextcloud.log.
This folder (/daten) is also the configured data-directory.

Just to sort out: Could you verify that www-data has rwx (file creation) permissions to /daten directory itself?

I think the permissions for www-data are given, but i’m not shure. I will check this at next tuesday (sorry thats the next possibility) and post the result here. Nextcloud has created the first nextcloud.log file by itselfs. The directory /daten is also the data-directory and creating from files and directories by nextcloud works fine.

The permissions to the /daten directory are:
drwxrwx— 48 www-data www-data 4096 Mär 22 08:41 daten
I think that should be enough to rotate the logfile?

Use logrotate:

root@nextcloud-test /h# cat /etc/logrotate.d/nextcloud
# Nextcloud logs
/var/log/nextcloud/nextcloud.log {
daily
missingok
rotate 30
compress
delaycompress
notifempty
create 640 apache apache
su root apache
}
3 Likes

Now i have configured the logrotate from the operating system. This works fine.
Because the rotate feature inside nextcloud, i don’t know what the problem.

Yeah logrotate should not be necessary here, but if you anyway have it to rotate the other logs within /var/log, then it is an adequate solution, at least giving some consistency about how the rotation works.

Did you consider opening an issue on github about it? https://github.com/nextcloud/server/issues
I guess the devs have a deeper insight in what might going wrong on your system/with Nextcloud internal rotation.