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
Step 1: Update Package List
sudo apt update
Step 2: Install Atop
sudo apt install atop
Step 3: Configure Atop for Logging Interval
Edit the Atop configuration file to set your desired logging interval:
sudo vi /etc/default/atop
Within this file, modify the LOGINTERVAL
, LOGGENERATIONS
, and LOGOPTS
settings:
LOGOPTS="-c" # Enable log file compression
LOGINTERVAL=300 # Log every 5 minutes (300 seconds) - adjust as needed
LOGGENERATIONS=7 # Keep 7 days of logs
Step 4: Restart Atop
Restart the Atop service to apply the new configuration:
sudo systemctl restart atop
Step 5: Verify Configuration
- Check the
/var/log/atop
directory. You should see files named likeatop_YYYYMMDD
being created daily. - Monitor the directory for a few days to ensure log files are being rotated and compressed correctly.
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 theatop
user has write permissions on the/var/log/atop
directory. Restart Atop. -
Log files are not being rotated: Ensure that
LOGGENERATIONS
is set correctly in/etc/default/atop
. -
Log files are too large: If disk space is a concern, consider increasing the
LOGINTERVAL
in/etc/default/atop
to reduce the logging frequency.
Additional Resources
Comments
0 comments
Please sign in to leave a comment.