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,batorlnavto view logs,sic. scubamuc >
"lessismore, fromheadtotailwithcatorbatbutlnavis the way to go! "
- install
lnavโsudo snap install lnav- issue command โ
sudo lnav /var/snap/nextcloud/current/logs/nextcloud.log
issue command in host shell to view nextcloud log with cat
sudo cat /var/snap/nextcloud/current/logs/nextcloud.log
Watch Nextcloud snap log (live)
issue command in host shell:
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 preferred to deleting the logs.
issue command in host shell:
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
datadirectory, 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
issue command in host shell:
sudo snap logs -f nextcloud.mysql
PHP log
issue command in host shell:
sudo snap logs -f nextcloud.php-fpm
Apache log
issue command in host shell:
sudo snap logs -f nextcloud.apache
Nextcloud Fixer log
issue command in host shell:
sudo snap logs -f nextcloud.nextcloud-fixer
Nextcloud snap 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.