Managing Nextcloud snap logs
Nextcloud snap logs
In the event of an issue the Nextcloud logs could help figure out a probable cause. Most activities and actions in Nextcloud are logged. An automated log rotation mechanism within Nextcloud clears and retains the logs regularly to prevent an overflow.
TIP
Apps for viewing logs:
Use your favourite viewerless
,more
,head
,tail
,cat
,bat
orlnav
to view logs,
"less
ismore
, fromhead
totail
withcat
orbat
butlnav
is the way to go! "sudo lnav /var/snap/nextcloud/current/logs/nextcloud.log
Watch Nextcloud snap log (live)
sudo nextcloud.occ log:watch
Truncate logs
Sometimes truncating the logs and waiting for the entry to reappear makes those entries more readable, since truncating the logs removes old entries and reduces overhead. Truncating your logs is definitely preferred to deleting the logs.
sudo truncate -s 0 /var/snap/nextcloud/current/logs/nextcloud.log
Nextcloud snap log locations
- Logs for Nextcloud:
/var/snap/nextcloud/current/logs/nextcloud.log
- Note that this wonโt be the case if youโve configured a custom
data
directory, for example somewhere in/media
. The nextcloud logs will then be stored on that same directory.
- Note that this wonโt be the case if youโve configured a custom
- Logs for Apache2:
/var/snap/nextcloud/current/logs/apache_access.log
- Logs for Redis:
/var/snap/nextcloud/current/logs/redis.log
- Logs for PHP-FPM:
/var/snap/nextcloud/current/logs/php-fpm_errors.log
- Logs for PHP:
/var/snap/nextcloud/current/logs/php_errors.log
- Logs for Certbot:
/var/snap/nextcloud/current/certs/certbot/logs/letsencrypt.log
- Logs for MySQL:
/var/snap/nextcloud/current/logs/mysql_errors.log
Nextcloud snap service logs
Nextcloud snap has several services contained within it. There are four that are most important for upgrade purposes:
- MySQL (nextcloud.mysql)
- PHP (nextcloud.php-fpm)
- Apache (nextcloud.apache)
- Nextcloud Fixer (nextcloud.nextcloud-fixer)
MySQL log
sudo snap logs -f nextcloud.mysql
PHP log
sudo snap logs -f nextcloud.php-fpm
Apache log
sudo snap logs -f nextcloud.apache
Nextcloud Fixer log
sudo snap logs -f nextcloud.nextcloud-fixer
Issue debugging script
Run the following command (copy and paste the entire thing into your terminal and press enter). Paste the output into the issue; itโs pre-formatted to be a nice comment, so only make it an attachment if itโs too long to be a comment.