No Log file rotation even when set, logs excessive size crashed server

@Rbruce259

for posterity, it is unclear whether you have changed the default data directory. see Change data directory

if this is true, the logs are located there instead of the default data directory. thus you’d need to set the path in config "logfile": "\/var\/snap\/nextcloud\/current\/logs\/nextcloud.log", to where that log file is located for the built-in Nextcloud log rotation to work as expected.

note also, permissions must be set correctly to enable log rotation. list permissions for your log file:
ls -al /var/snap/nextcloud/current/logs/nextcloud.log or non-default path…
it should look like this;
image

alternatively create a cronjob for log rotation or run a script:

#!/bin/bash

## system-wide logs ##
sudo journalctl --rotate && ## log rotation ##
sudo journalctl --vacuum-time=2days &&  ## retention in days ##
## nextcloud-snap logs default directory ##
sudo truncate -s 0 /var/snap/nextcloud/current/logs/nextcloud.log &&  ## truncate to clear ##
exit