Skip to content

Odoo Log Rotation & Management: Stop Logs From Filling Your Disk

DeployMonkey Team · March 22, 2026 8 min read

The Problem

Odoo log files grow continuously. Without rotation, they fill the disk in days or weeks. A single Odoo log file can grow to 10-50GB, crashing the server when disk reaches 100%.

Quick Fix: Set Up logrotate

# Create logrotate config:
sudo cat > /etc/logrotate.d/odoo << 'EOF'
/var/log/odoo/*.log {
    daily
    rotate 14
    compress
    delaycompress
    missingok
    notifempty
    copytruncate
    maxsize 100M
}
EOF

# Test it:
sudo logrotate -d /etc/logrotate.d/odoo  # dry run
sudo logrotate -f /etc/logrotate.d/odoo  # force run

Key Options Explained

  • daily — Rotate every day
  • rotate 14 — Keep 14 days of logs
  • compress — Gzip old logs (saves 80-90% space)
  • copytruncate — Truncate the log file instead of renaming (Odoo keeps writing to the same file descriptor)
  • maxsize 100M — Also rotate if log exceeds 100MB within a day

Log Levels

# odoo.conf:
log_level = info      # Production (recommended)
# log_level = warning  # Minimal logging (production, low traffic)
# log_level = debug    # Development only (VERY verbose)

# Per-module logging:
log_handler = :INFO,odoo.addons.my_module:DEBUG
# Everything at INFO, but my_module at DEBUG

Log to Syslog (Alternative)

# Instead of file logging, use syslog:
# odoo.conf:
syslog = True
logfile = False  # Disable file logging

# Syslog handles rotation automatically
# Logs go to /var/log/syslog or journald

# View with:
journalctl -u odoo --since today
journalctl -u odoo -f  # Follow in real-time

Immediate Fix: Truncate Oversized Log

# If disk is already full:
# Check log size:
ls -lh /var/log/odoo/odoo.log

# Truncate (keeps file descriptor open):
truncate -s 0 /var/log/odoo/odoo.log
# This is safe — Odoo continues writing to the same file

# Then set up logrotate to prevent recurrence

Best Practices

  • Always configure logrotate before going to production
  • Use log_level = info in production (not debug)
  • Keep 7-14 days of compressed logs
  • Monitor log file size as part of disk monitoring
  • Use copytruncate — Odoo doesn't reopen log files on SIGHUP
  • Consider syslog + journald for systemd-managed Odoo

DeployMonkey

DeployMonkey configures log rotation automatically for all Odoo instances. The AI agent monitors log file sizes and adjusts logging levels based on disk pressure.