How to clear traffic logs in UniFi
Published onby Iron
Traffic logs are essential for monitoring network activity, troubleshooting issues, and understanding bandwidth usage. But sometimes, you just want to start fresh. Clearing traffic logs in UniFi is a quick way to free up storage, improve system performance, and regain some privacy.
Let's dive in!

Table of Contents
- Why clear UniFi traffic logs?
- How UniFi traffic logs work
- How to clear traffic logs in UniFi
- How to automate log clearing
- FAQs
- Final Thoughts
Why clear UniFi traffic logs?
Clearing traffic logs is more than just wiping history. Here’s why you might want to do it:
- Free up storage: Logs can eat up storage space, especially on devices like the Cloud Key or UDM.
- Privacy: Protect network usage data from being viewed by admins or IT support teams.
- Reduce clutter: Make it easier to review active and relevant traffic logs.
- Speed up performance: Large log files can slow down system processing and UI performance.
If any of these reasons apply to you, it’s time to clear those logs. Let's get started.
How UniFi traffic logs work
Before you dive into clearing logs, it helps to know what logs you’re dealing with. UniFi creates multiple types of logs:
- Event Logs: These show system alerts, errors, and changes to the system.
- Traffic Logs: These track network usage, bandwidth stats, and device activity.
- System Logs: Logs generated by the UniFi operating system (like errors and crashes).
For this guide, we’re focusing on traffic logs.
How to clear traffic logs in UniFi
Method 1: Clear logs using the UniFi Controller UI
This method works if you have access to the UniFi Controller (web or mobile app) and want to do it through the user interface.
Steps:
-
Log in to your UniFi Controller
Open a browser and navigate to your UniFi Controller URL (e.g., https://unifi.yourdomain.com), or if you're self-hosting, use https://:8443. Log in with your username and password. -
Go to the Settings section
On the left-hand sidebar, click on the Settings (gear) icon. -
Select System Settings
In the settings menu, look for the "System" tab or "Advanced Features" depending on your controller version. Click on it. -
Locate the log management options
Scroll down to find options related to "Logs" or "Traffic Logs." If you're using a Dream Machine or UDM Pro, it may be under Console Settings. -
Clear traffic logs
Look for a button or toggle that says Clear Logs, Reset Logs, or Purge Logs. Click it.Pro tip: If you don't see an option to clear logs, you may need to enable "Advanced Settings" within the settings page.
-
Restart the Controller
Some logs might be cached. To ensure everything is cleared, reboot your UniFi Controller. You can do this via the Controller UI under Settings > System > Restart Console.
Method 2: Clear logs via SSH
If you have access to the device's command line (SSH), you can clear logs directly from the server. This method is useful if you are using a Cloud Key or a UniFi Controller hosted on Linux, Windows, or macOS.
Prerequisites
- SSH access to your UniFi Controller.
- Admin privileges to run commands.
Steps:
-
Log in to the Controller via SSH
ssh admin@<controller-ip>
Replace "
" with your controller’s IP address (e.g., 192.168.1.10). -
Navigate to the log files
cd /usr/lib/unifi/logs/
-
View available logs List all the logs in this directory:
You will see files like:ls -lh
The exact filenames may vary depending on your UniFi controller version.mongod.log server.log system.log wifi.log
-
Delete traffic logs If you want to clear a specific log file (like "server.log"), use:
This command clears the content of the "server.log" file without deleting the file itself.sudo truncate -s 0 server.log
-
Clear all log files at once To clear all log files in the directory at once:
sudo find /usr/lib/unifi/logs/ -type f -exec truncate -s 0 {} \;
-
Restart the UniFi service
sudo service unifi restart
Note: Be cautious with this method. Deleting the wrong logs can impact system performance or delete important data.
Method 3: Use the UniFi mobile app
If you’re managing your UniFi network from the mobile app, you can clear some logs using the app. However, this method has limitations.
Steps:
- Open the UniFi mobile app on your phone.
- Sign in to your controller using your UniFi account.
- Tap the settings icon (gear icon) in the bottom-right corner.
- Go to Advanced or Logs section depending on the app version.
- Look for Clear Logs option. If it's available, tap it.
Note: This option may not be present in all versions of the mobile app. If you can't find it, use the web UI or SSH method.
How to automate log clearing
If you want to automatically clear logs every week, you can schedule a log clean-up using cron (on Linux) or Task Scheduler (on Windows).
Linux/UniFi Controller (cron job)
-
Open crontab to create a new task:
crontab -e
-
Add this entry to clear logs at 3 AM every Sunday:
0 3 * * 7 find /usr/lib/unifi/logs/ -type f -exec truncate -s 0 {} \;
-
Save and exit the crontab editor.
This will ensure your logs are cleared weekly, automatically.
Windows (Task Scheduler)
-
Open Task Scheduler.
-
Create a new task that runs the following command at a specific time (e.g., every Sunday at 3 AM):
del "C:\Users\<your-user>\Ubiquiti UniFi\logs\*.log"
- Save the task, and your traffic logs will clear automatically.
FAQs
Will clearing logs affect my network?
No, clearing traffic logs will not impact your network’s performance. However, you will lose access to previous traffic history.
How often should I clear logs?
If you have a device with limited storage (like a UniFi Cloud Key), you should clear logs every month. For devices with larger storage (like Dream Machines), you can clear them less often.
Can I see who cleared the logs?
No, there is no audit trail for log clearing actions. If you're an admin, you can clear logs, and no one will know.
Final Thoughts
Clearing UniFi traffic logs is quick and simple, and it helps free up storage, protect privacy, and reduce clutter. You can clear logs via the Controller UI, SSH, or the mobile app.
If you’re looking for a more hands-off approach to managing your UniFi Controller, consider using UniHosted. Our cloud-hosted UniFi service handles log storage, updates, and controller management, so you don’t have to worry about it. If you would like me to personally walk you through UniHosted, you can schedule a call with me here.
We host UniFi Controllers in the Cloud
Are you ready to take your UniFi Network to the next level? Deploy a UniFi Cloud Controller in minutes and manage your network from anywhere.
Free tier available
Get the best support
Join 1660+ customers
No credit card required