
Managing a self-hosted cloud environment comes with its share of maintenance tasks, and keeping log files under control is one of them. Over time, Nextcloud logs can grow significantly, consuming disk space, slowing the admin interface, and making it harder to spot relevant errors.
This article will discuss what Nextcloud logs are and whether they can be cleared, where log files are located across different server setups, the distinct types of log files administrators should know, how to safely clear them via the Linux terminal, how to configure log rotation, and how to set the right log level for a production environment.
Nextcloud logs can be cleared, but there is no built-in button in the admin interface to do it. The Log Reader app, under Administration Settings, Logging, only supports viewing and downloading entries. Clearing requires direct Linux terminal access: either run truncate -s 0 on the nextcloud.log file, or delete the file entirely; Nextcloud will automatically recreate it on the next loggable event.
Nextcloud logging is the built-in mechanism that records system events, errors, warnings, and user activity within a Nextcloud instance. It serves three core purposes for administrators:
By default, when log_type is set to file in config.php, Nextcloud writes all log data to a file named nextcloud.log in the server's data directory. In busy instances, or when the log level is set too low, this file can grow to several gigabytes within weeks. Managing it is one of many ongoing responsibilities that come with running a self-hosted instance.
Administrators who prefer to have server maintenance, security updates, and backups handled for them often opt for a managed Nextcloud hosting solution, where the infrastructure is fully managed, and the technical overhead is eliminated.
To answer the question directly: yes, Nextcloud logs can be cleared. However, Nextcloud does not provide a one-click clear button in its admin interface. The Log Reader app, accessible under Administration Settings, then Logging, allows administrators to view and download log entries, but it does not offer an option to delete or wipe them. Clearing the log requires direct access to the server via the Linux terminal.
By default, if log_type is set to file, Nextcloud writes to [datadirectory]/nextcloud.log. You can confirm the datadirectory value and optionally override the log path with the logfile parameter in config/config.php:
'datadirectory' => '/var/www/nextcloud/data',
'logfile' => '/var/www/nextcloud/data/nextcloud.log',
Log file locations vary depending on the installation method:
A custom log path can be set by adding or modifying the logfile parameter in config/config.php. When doing so, ensure the directory exists and that the web server user, typically www-data or apache, has write permissions to that path.
Nextcloud generates two native log files, and knowing what each one records prevents administrators from clearing the wrong one.
This is the primary log file where all core system events, warnings, and errors are recorded. It is the file visible in the admin interface under Administration Settings, then Logging, and is most commonly the target for clearing.
Generated by the admin_audit app, this file records a complete audit trail, including user session information, file handling, user management, sharing, and other administrative actions. It is particularly relevant for compliance and security monitoring and should not be cleared without careful consideration.
It is worth noting that web servers like Apache and Nginx maintain their own log files, such as /var/log/apache2/error.log or /var/log/nginx/error.log, which are independent of Nextcloud and managed by the web server itself.
The following commands are run on your Linux server via SSH or direct terminal access. There are two reliable methods to clear the primary nextcloud.log file.
Method 1: Truncate the log file
Truncating empties the file without deleting it, which means Nextcloud continues writing to the same file path without interruption. This is the safest and most recommended approach:
sudo truncate -s 0 /var/www/nextcloud/data/nextcloud.log
For Snap installations:
sudo truncate -s 0 /var/snap/nextcloud/current/logs/nextcloud.log
Method 2: Delete the log file
Deleting the file is also safe. Nextcloud will automatically recreate nextcloud.log the next time a loggable event occurs:
sudo rm /var/www/nextcloud/data/nextcloud.log
After using either method, the log viewer under Administration Settings, Logging will reflect the cleared state on the next page load. If rotated log files exist, such as nextcloud.log.1, they should also be removed if a full cleanup is the goal.
Note: If log_type in config.php is set to syslog, systemd, or errorlog, there is no nextcloud.log file to truncate. In those cases, clearing logs is done through your system's logging backend, such as journalctl for systemd or your syslog daemon.
Configuring log rotation ensures the nextcloud.log file never grows unmanageable in the first place.
Nextcloud's built-in rotation is controlled by the log_rotate_size parameter in config.php. The value is set in bytes, for example, 104857600 for 100 megabytes. When the log file reaches that size, Nextcloud creates a new rotated file. If a previously rotated file already exists, it will be overwritten. This can be set directly in config.php:
php
'log_rotate_size' => 104857600,
Or configured via the occ command without editing config.php manually:
sudo -u www-data php occ config:system:set log_rotate_size --value=104857600 --type=integer
```
**OS-level log rotation** using `logrotate` gives administrators more control, including compression of old logs and retention of multiple rotated files. A basic `logrotate` configuration for Nextcloud looks like this:
```
/var/www/nextcloud/data/nextcloud.log {
weekly rotate 4 compress missingok notifempty }
Nextcloud's built-in rotation is purely size-based; it does not run on a schedule. Scheduling, compressing, and retaining multiple archived log files requires OS-level tools such as logrotate.
Log levels directly control how much data Nextcloud writes, and choosing the wrong level is one of the most common reasons log files grow out of control. Nextcloud supports five levels:
The log level is set in config.php:
php 'loglevel' => 2, Or via occ:
sudo -u www-data php occ config:system:set loglevel --value=2 --type=integer
For most production environments, level 2 (WARN) or level 3 (ERROR) is appropriate. Setting the level to 0 temporarily when troubleshooting is acceptable, but leaving DEBUG mode active permanently is not recommended. At that level, the volume of entries written can degrade server performance and fill storage rapidly.
Nextcloud logs can be cleared safely and without risk to the system. Truncating the nextcloud.log file is the cleanest approach, it empties the file instantly while keeping the logging pipeline intact. Beyond manual clearing, the real solution to runaway log files is a combination of proper log rotation via log_rotate_size in config.php and an appropriate log level set for production. Administrators who configure both rarely need to clear logs manually. Understanding the distinction between nextcloud.log and audit.log also ensures the correct file is managed, preventing the accidental removal of data needed for security or compliance.

Nextcloud ist Open Source Software. Da die Plattform selbst kostenlos heruntergeladen werden kann, gehen viele Organisationen davon aus, dass der Betrieb ihrer eigenen Cloud-Umgebung günstig ist. Auf den ersten Blick scheint die Logik einfach. Miete einen kleinen VPS, installiere die Software, und Deine private Cloud ist bereit. In der Praxis enden Nextcloud Hosting Costs selten beim monatlichen Preis eines Servers. Der Betrieb einer zuverlässigen Nextcloud-Umgebung erfordert Infrastruktur-Kon

Langsame Datei-Uploads, eine träge Weboberfläche und unzuverlässige Synchronisation sind keine zufälligen Probleme. Sie sind Symptome eines zugrunde liegenden Konfigurationsproblems und verschlechtern sich tendenziell, je mehr Deine Daten und Nutzerzahlen wachsen. Die meisten Nextcloud-Installationen laufen langsam, nicht wegen der Software selbst, sondern weil die Serverumgebung nie richtig dafür optimiert wurde. Dieser Artikel erklärt die tatsächlichen Ursachen für schlechte Nextcloud-Perform

Nextcloud ist eine self-hosted Plattform, was bedeutet, dass Deine Dateien auf Hardware liegen, die Du kontrollierst, und nicht bei einem Drittanbieter-Cloud-Service. Das gibt Dir die volle Kontrolle über Deine Daten, bedeutet aber auch, dass Dein Server standardmäßig in einem privaten Netzwerk sitzt. Er ist nicht automatisch über das Internet erreichbar. Um remote auf Nextcloud zuzugreifen, brauchst Du eine gezielte Netzwerk-Konfiguration. Du musst entscheiden, wie der Traffic Deinen Server er
PEWEO SARL
5, Montée des Aulnes
L-6611 Wasserbillig
LU33030425