Skip to main content
Crusoe Support Help Center home page
Crusoe

How-To Install and Configure Atop with Log Retention on Ubuntu 22.04/24.04

Matt Roark
Matt Roark
Updated

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

  1. Update Package List
    • sudo apt update
  2.  Install Atop
    • sudo apt install atop
  3. Configure Atop for 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
  4. Restart Atop

    • Restart the Atop service to apply the new configuration

      sudo systemctl restart atop
  5. Verify Configuration
    • Check the /var/log/atop directory. You should see files named like atop_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 the atop user has write permissions on the /var/log/atop directory. Restart Atop: sudo systemctl 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

 

 

Related to

Was this article helpful?

0 out of 0 found this helpful

Still need help?

Our support team is ready to assist you with any questions.

Have more questions? Submit a request

Recently Viewed

Comments

0 comments

Article is closed for comments.