Last Updated: Oct 21, 2025
Introduction
Atop is a system performance monitor that provides a detailed view of CPU, memory, disk, and network activity. This guide explains how to install Atop on Ubuntu 22.04 and 24.04 and configure log retention to limit disk usage while maintaining valuable performance data. Limiting log retention is crucial for managing disk space, especially on systems with limited resources. This guide focuses on minimizing resource utilization by configuring Atop to collect essential data without excessive logging.
Prerequisites
- Ubuntu 22.04/24.04 OS
-
Estimated Disk Space Requirements (for logs): Disk space requirements vary based on the logging interval.
- 5-minute logging: Expect approximately 700MB - 1.4GB for 7 days of logs.
- 10-minute logging: Expect approximately 350MB - 700MB for 7 days of logs.
- 30-minute logging: Expect approximately 115MB - 230MB for 7 days of logs.
Note: These are estimates. Actual usage depends on system activity. It's always recommended to monitor disk usage after implementing this configuration.
Step-by-Step Instructions
-
Update Package List
sudo apt update
-
Install Atop
sudo apt install atop
-
Configure Atop for Logging Interval
sudo vi /etc/default/atop-
Within this file, modify the
LOGINTERVAL,LOGGENERATIONS, andLOGOPTSsettings:LOGOPTS="-c" # Enable log file compression LOGINTERVAL=300 # Log every 5 minutes (300 seconds) - adjust as needed LOGGENERATIONS=7 # Keep 7 days of logs
-
Restart Atop
-
Restart the Atop service to apply the new configuration
sudo systemctl restart atop
-
-
Verify Configuration
- Check the
/var/log/atopdirectory. You should see files named likeatop_YYYYMMDDbeing created daily. - Monitor the directory for a few days to ensure log files are being rotated and compressed correctly.
- Check the
Understanding Logging Intervals
The LOGINTERVAL setting determines how often Atop records system activity.
- Shorter intervals (e.g., 5 minutes): Provide more granular data, allowing for detailed analysis of short-term events. However, this increases disk I/O and log file sizes.
- Longer intervals (e.g., 30 minutes): Reduce disk usage and I/O overhead but provide less granular data.
Choose an interval that balances your need for detailed data with disk space and performance considerations.
Example
With the above configuration (5-minute logging), after a week, you'll have 7 compressed log files (e.g., atop_20250213.gz, atop_20250214.gz,..., atop_20250219.gz) containing 5-minute interval data for each day. You can then use the atop -r command to analyze these historical log files.
Common Issues and Resolutions
-
Log files are not being created: Verify the settings in
/etc/default/atop. Ensure theatopuser has write permissions on the/var/log/atopdirectory. Restart Atop:sudo systemctl restart atop. -
Log files are not being rotated: Ensure that
LOGGENERATIONSis set correctly in/etc/default/atop. -
Log files are too large: If disk space is a concern, consider increasing the
LOGINTERVALin/etc/default/atopto reduce the logging frequency.
Additional Resources