Can Nextcloud Logs Be Cleared?

Jay

Desktop Interface
6 Min. Lesezeit|25.03.2026

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.

Key Takeaway

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.

What Are Nextcloud Logs and Why Does It Matter?

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:

  • Monitoring: Tracking the overall health and behavior of the server.
  • Troubleshooting: Identifying the root cause of errors, failed operations, or unexpected behavior.
  • Security: Detecting unauthorized access attempts, unusual login patterns, and suspicious file activity.

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.

Where Nextcloud Log Files Are Located

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:

  • Standard Linux (Apache/Nginx): Typically /var/www/nextcloud/data/nextcloud.log, but always confirm via config.php
  • Snap installation: /var/snap/nextcloud/current/logs/nextcloud.log
  • Docker/AIO: Determined by your volume mapping. Run docker inspect <container_name> to locate the mapped data directory, then confirm the logfile path inside config.php

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.

Types of Nextcloud Log Files

Nextcloud generates two native log files, and knowing what each one records prevents administrators from clearing the wrong one.

nextcloud.log

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.

audit.log

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.

Try managed Nextcloud now

How to Clear Nextcloud Logs

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

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.

Setting the Right Log Level

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:

  • 0 – DEBUG: Records all activity. Extremely detailed and generates the highest log volume.
  • 1 – INFO: Logs file activity, user logins, warnings, and errors.
  • 2 – WARN: Records warnings from successful operations alongside errors and critical failures.
  • 3 – ERROR: Captures only critical errors and failed operations that do not affect other services.
  • 4 – FATAL: Logs only the most severe system-level failures.

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.

Conclusion

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.

Der Cloud-Assistent, der immer einen Schritt voraus ist.

Unser Blog

Cloud-Einblicke: Trends, Tipps & Technologien

Nextcloud Hosting Costs: Was Du tatsächlich über den Server hinaus bezahlst
6 Min. Lesezeit|02.04.2026

Nextcloud Hosting Costs: Was Du tatsächlich über den Server hinaus bezahlst

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

Warum ist Nextcloud langsam und wie kannst Du es beschleunigen
7 Min. Lesezeit|01.04.2026

Warum ist Nextcloud langsam und wie kannst Du es beschleunigen

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

So greifst Du remote auf Nextcloud zu
7 Min. Lesezeit|01.04.2026

So greifst Du remote auf Nextcloud zu

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

Kontaktieren Sie unsere Cloud-Experten

Schreiben Sie uns
Chat

Schreiben Sie uns

Unser freundliches Team hilft Ihnen gerne

Cbb logo
Sichere Echtzeit-Cloud-Zusammenarbeit aus Europa
CloudBased Backup bietet Ihnen Managed Nextcloud – eine sichere Kollaborationsplattform mit Echtzeit-Dokumentenbearbeitung, nahtlosem Videochat und Groupware auf Mobilgeräten, Desktop und im Web.
Besuchen Sie uns in den sozialen Medien.
Abonnieren Sie unseren Newsletter.
Erhalten Sie exklusive Angebote und bleiben Sie immer auf dem Laufenden.

Kontaktieren Sie uns direkt unter

PEWEO SARL

5, Montée des Aulnes

L-6611 Wasserbillig

LU33030425

© 2026 CloudBased Backup. Alle Rechte vorbehalten.