nextcloud.log is big

Hello
in
/var/www/nextcloud/data#
i found a big log file
42G 9. Sep 20:25 nextcloud.log
569M 14. Jul 06:18 nextcloud.log.1
other log files are much smaller, it is normal?

try to find out why my server run out of disk space?

have a nice day
vinc

Hello @vinc,
welcome to the community of Nextcloud :handshake:

You started a topic in support category. Unfortunately you ignored the template and a lot of information to help you is missing. Please edit your original post and add all required details like Nextcloud version, webserver type and version, os version, related log file content. Use the support template.

Without additional information the community members cannot help you.

please be clear –> you have discovered a large log file on your server from today?

no that is not normal!

did you have a look at that log file to see what caused the file to blow up? that’s what log files are there for.

if there’s nothing in that log that interests you… and your instance is running fine, just delete it! Note, gone is gone! so be sure.

the nextcloud.log
file has no structure

checked with multitail and cat and not date/time stamp

deletet and start to fill in
just a mess

PHP 8.2.29
Apache/2.4.65 (Debian)
Nextcloud Hub 9 (30.0.13)
and how to use the occ command without sudo?

you will not be able to do anything without admin permissions… you casn’t delete that log file with OCC command as far as I know.

it may be a better idea to truncate that log instead… but you will need shell access and admin permissions:

sudo truncate -s 0 /path/to/logs/nextcloud.log

@scubamuc

thanks for your feedback.
i am root so i have access and able to delete - it just start to fill in again

truncate works empty the file!

can you restart the instance at all? you need to find out what is causing your logs to blow up!

it has a structure - json! if you would have used search you easily find 101: logging, which logs exist, how to access and understand and please review 101: Self-hosting information for beginners

1 Like

There are a multitude of → configuration options regarding logging

If your log file is that huge, my first guess would be that your log level is much too low, probably ‘0’ or ‘1’. ‘3’ is perfectly sufficient for everyday use!

Then you can have your logs written to a different directory (which must exist and be owned by the nextcloud user), e.g., /var/log/nextcloud/, and let the logrotate service handle log rotation. It’s more reliable.

Here an example for a /etc/logrotate.d/nextcloud

/var/log/nextcloud/*.log {
    rotate 4
    su www-data www-data
    size 10485760
    missingok
    create 640 www-data www-data
    compress
    delaycompress
}

This will rotate the log once it exceeds 10 MB and keep 4 old log files and compress them starting from the second file.


ernolf

5 Likes