Can Nextcloud Logs Be Cleared?

Jay

Desktop Interface
6 min read|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.

Secure and privacy-first managed Nextcloud hosted in Germany.

Our Blog

Cloud Insights: Trends, Tips & Technologies

How To Use Nextcloud Office
6 min read|08.04.2026

How To Use Nextcloud Office

Browser-based collaboration tools have become essential for teams and businesses that need to work efficiently across locations. Nextcloud Office provides a secure platform for creating and editing documents, spreadsheets, and presentations without relying on traditional desktop software. Nextcloud Office is typically powered by Collabora Online (or Collabora CODE for smaller deployments), ensuring compatibility with standard Office formats. This guide will walk you through using Nextcloud Offi

How To Use Nextcloud Talk
7 min read|03.04.2026

How To Use Nextcloud Talk

Nextcloud Talk is part of the Nextcloud platform, and knowing how to use it properly is important if you want to manage team communication, calls, and meetings directly within your own environment. This guide focuses on how to use Nextcloud Talk in practical terms. It walks through setup, interface basics, messaging and calling features, and key settings that affect daily use. The goal is to help you use it efficiently without unnecessary steps or confusion. Key Takeaway Nextcloud Talk

How To Install Nextcloud On Ubuntu
6 min read|02.04.2026

How To Install Nextcloud On Ubuntu

Managing your own cloud storage gives you control over your files and data privacy. Installing Nextcloud on an Ubuntu server lets you run a self-hosted cloud environment on stable, supported software. This guide covers everything from setting up your server to accessing Nextcloud in a web browser, so you can quickly deploy a secure, functional cloud solution. Key Takeaway Installing Nextcloud on Ubuntu via Snap offers a quick, reliable way to deploy a self-hosted cloud server with minim

Get in Touch with Our Cloud Experts

Chat with us
Chat

Chat with us

Our friendly team is here to help

Cbb logo
Secure real-time Cloud collaboration from Europe
CloudBased Backup empowers you with Managed Nextcloud, a secure, on-premise collaboration platform offering real-time document editing, seamless video chat, and groupware across mobile, desktop, and web.
Visit us on social media.
Subscribe to our newsletter.
Get exclusive offers and always stay up-to-date.
© 2026 CloudBased Backup. All rights reserved.