Skip to content

Odoo Log Management: Logrotate, Retention & Monitoring

DeployMonkey Team · March 23, 2026 7 min read

Odoo Logging Basics

Odoo generates significant log output in production. Without proper management, logs consume disk space and make debugging difficult. This guide covers advanced log configuration, rotation, and monitoring strategies.

Odoo Log Configuration

# /etc/odoo.conf log settings
[options]
logfile = /var/log/odoo/odoo.log
logrotate = True
log_level = warn
log_handler = :WARNING,odoo.models:WARNING
log_db = False
log_db_level = warning

# Log levels (least to most verbose):
# critical, error, warning, info, debug
# debug_rpc, debug_rpc_answer, debug_sql

# Per-module log levels:
log_handler = :WARNING,odoo.addons.my_module:DEBUG

Logrotate Configuration

# /etc/logrotate.d/odoo
/var/log/odoo/*.log {
    daily
    rotate 30
    missingok
    notifempty
    compress
    delaycompress
    copytruncate
    su odoo odoo
    maxsize 100M
    dateext
    dateformat -%Y%m%d
}

# Key directives:
# daily: rotate every day
# rotate 30: keep 30 days of logs
# compress: gzip old logs
# delaycompress: compress on next rotation (not current)
# copytruncate: truncate in place (no restart needed)
# maxsize 100M: also rotate if file exceeds 100MB

Disk Space Monitoring

# Check log disk usage
du -sh /var/log/odoo/
df -h /var/log/

# Alert on disk space (cron job)
# /etc/cron.d/odoo-disk-check
*/30 * * * * root \
  USAGE=$(df /var/log --output=pcent | tail -1 | tr -d ' %'); \
  [ $USAGE -gt 85 ] && \
  echo "Log disk at ${USAGE}%" | mail -s "Disk Alert" [email protected]

# Emergency cleanup:
# Truncate (not delete) active log
truncate -s 0 /var/log/odoo/odoo.log
# Delete old compressed logs
find /var/log/odoo/ -name "*.gz" -mtime +14 -delete

Structured Logging

# Odoo 19 supports JSON logging (syslog format)
# Useful for log aggregation tools

# Send to syslog instead of file:
[options]
logfile = False
syslog = True

# Then configure rsyslog/journald to forward
# /etc/rsyslog.d/odoo.conf
if $programname == 'odoo' then /var/log/odoo/odoo.log
& stop

Centralized Logging

# Forward Odoo logs to centralized systems:

# Option 1: Filebeat → Elasticsearch
# /etc/filebeat/filebeat.yml
filebeat.inputs:
- type: log
  paths:
    - /var/log/odoo/odoo.log
  fields:
    service: odoo
  multiline.pattern: '^\d{4}-\d{2}-\d{2}'
  multiline.negate: true
  multiline.match: after

# Option 2: Promtail → Loki → Grafana
# Option 3: rsyslog → remote syslog server

Useful Log Grep Patterns

# Find errors in last hour
journalctl -u odoo --since "1 hour ago" -p err

# Slow queries (>1s)
grep "query.*[0-9]\{4,\} ms" /var/log/odoo/odoo.log

# Failed login attempts
grep "Login failed" /var/log/odoo/odoo.log

# Memory warnings
grep "MemoryError\|memory limit" /var/log/odoo/odoo.log

# Cron job failures
grep "cron.*error\|ir.cron.*fail" /var/log/odoo/odoo.log

DeployMonkey

DeployMonkey configures log rotation, disk monitoring, and log viewing automatically for every Odoo instance. View logs directly from the control panel.