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.

The Cloud Assistant That's Always One Step Ahead.

Our Blog

Cloud Insights: Trends, Tips & Technologies

Secure File Sharing for Business: How Companies Use Nextcloud for Collaboration
8 min read|27.03.2026

Secure File Sharing for Business: How Companies Use Nextcloud for Collaboration

Businesses share sensitive files such as contracts, financial records, customer data, and internal documents every day across teams, devices, and external partners. At the same time, the risks are also increasing. The average cost of a data breach in 2023 reached $4.45 million, and many incidents are linked to unsecured cloud-based file transfers. Even a simple mistake, like sending a file to the wrong recipient, can trigger a GDPR violation. Remote work and constant collaboration with client

What Is Nextcloud Used For?
6 min read|26.03.2026

What Is Nextcloud Used For?

Managing files, communicating with teams, and staying organized no longer requires juggling multiple platforms. Modern cloud solutions are built to handle it all in one place, and Nextcloud is one of the most capable examples of that shift. With over 400,000 deployments globally, it has grown into one of the most trusted private cloud solutions available today. This article will discuss what Nextcloud is, walk through its core use cases, and explain who it is built for, giving you a clear pictu

GDPR‑Compliant Cloud Storage: What Businesses Need to Know (and How Nextcloud Hosting Helps)
8 min read|24.03.2026

GDPR‑Compliant Cloud Storage: What Businesses Need to Know (and How Nextcloud Hosting Helps)

Storing data in the cloud is no longer enough. Where it is stored, who can access it, and how it is protected now determine your GDPR risk. For any business handling customer or employee data, choosing a GDPR-compliant cloud storage solution is no longer optional but a basic obligation. Despite years of enforcement, many organisations are still behind. A significant number of businesses are still uncertain about their level of GDPR compliance, especially when it comes to cloud storage and data

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.

Reach out directly at

PEWEO SARL

5, Montée des Aulnes

L-6611 Wasserbillig

LU33030425

© 2026 CloudBased Backup. All rights reserved.