If you need to troubleshoot Nextcloud, your first task should be to enable logging. Find out how.
If you rely on Nextcloud as your on-premises cloud platform, you've probably discovered how flexible and reliable that tool is. And if you administer Nextcloud, you really understand that sentiment.
However, you might have also discovered that, out of the box, Nextcloud doesn't have logging enabled. This can be problematic … especially when you're trying to troubleshoot a problem or two. Without logging enabled, where do you turn for information about issues?
Instead of scrambling to solve those problems without the proper data for your quest, let's make it easy and enable logging. Once you have this feature up and running, your troubleshooting will be exponentially easier.
SEE: Serverless computing: A guide for IT leaders (TechRepublic Premium)
What you need
The only things you'll need for this are:
- A working instance of Nextcloud.
- A user account (on the Nextcloud server) with sudo privileges.
With those bits ready, let's make this happen. I'll be demonstrating with Nextcloud installed on Ubuntu Server 18.04.
Creating the log file
First we need to create a log file. We'll have Nextcloud log to /var/log/nextcloud.log. Create that file with the command:
sudo touch /var/log/nextcloud.log
Once the file is created, give it the proper ownership with the command:
sudo chown www-data:www-data /var/log/nextcloud.log
Now that the log file has the proper permissions, let's configure Nextcloud to write to it.
Open the Nextcloud configuration file with the command:
sudo nano /var/www/html/nextcloud/config/config.php
In that file add the following (under 'installed' => true,):
"log_type" => "file",
"logfile" => "/var/log/nextcloud.log",
'logfilemode' => 0640,
"loglevel" => "0",
"logdateformat" => "F d, Y H:i:s",
Figure A illustrates how the configuration should look.
The log levels are:
- 0: DEBUG: All activity; the most detailed logging.
- 1: INFO: Activity such as user logins and file activities, plus warnings, errors, and fatal errors.
- 2: WARN: Operations succeed, but with warnings of potential problems, plus errors and fatal errors.
- 3: ERROR: An operation fails, but other services and operations continue, plus fatal errors.
- 4: FATAL: The server stops.
Level 3 is the most often used. If you're trying to solve a problem, and log level 3 isn't giving you enough information, set it to 0.
Save and close that file. Restart Apache with the command:
sudo systemctl restart apache2
Once you have Nextcloud configured for logging, you can use the built-in facility. Log into Nextcloud (with an admin account), click on the profile icon in the upper-right corner, and click Settings. In the Settings window, click Logging and you should see each log entry (Figure B).
You can also change the log level from within the Nextcloud UI. Click the menu button to the right of Level and select the level of logging you want (Figure C).
And that's all it takes to enable logging for Nextcloud 16. Anyone who administers Nextcloud should do this as soon as the server is installed. With this in place, troubleshooting the platform will be so much easier.
- Hybrid cloud: A cheat sheet (TechRepublic)
- Hybrid cloud: A guide for IT pros (TechRepublic download)
- How to install Nextcloud 16 on Ubuntu 18.04 (TechRepublic)
- How to connect Thunderbird contacts to Nextcloud (TechRepublic)
- How to authenticate Nextcloud to an OpenLDAP server (TechRepublic)
- How to install and connect the new Nextcloud desktop client (TechRepublic)
- Dropbox says SMR adoption has made it cheaper to run its data centers (ZDNet)
- Top cloud providers 2019: AWS, Microsoft, Azure, Google Cloud; IBM makes hybrid move; Salesforce dominates SaaS (ZDNet)
- Best cloud services for small businesses (CNET)
- Microsoft Office vs Google Docs Suite vs LibreOffice (Download.com)
- Cloud computing: More must-read coverage (TechRepublic on Flipboard)