Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
      • Get a Tailored Demo
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +32 2 290 34 90
    • Get a Tailored Demo
  • Pricing
  • Help
  1. APPS
  2. Technical
  3. Logging Cleanup v 19.0
  4. Sales Conditions FAQ

Logging Cleanup

by Technology Pill Business Solution https://tecpill.com/ , Sayed Mohammed Aqeel Ebrahim https://tecpill.com/
Odoo
v 19.0 Third Party 26
Download for v 19.0 Deploy on Odoo.sh
Apps purchases are linked to your Odoo account, please sign in or sign up first.
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 317
Technical Name logging_clean_up
LicenseLGPL-3
Websitehttps://tecpill.com/
Versions 16.0 17.0 18.0 19.0
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 317
Technical Name logging_clean_up
LicenseLGPL-3
Websitehttps://tecpill.com/
Versions 16.0 17.0 18.0 19.0
Technology Pill Business Solution Logo

Logging Cleanup

Configurable log retention policies, cleanup rotation modes, and manual cleanup for ir.logging in Odoo 19.

Logging Cleanup Banner

What Makes This Module Special

  • Configurable log retention policies per log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
  • Two rotation modes: time-based and count-based cleanup strategies
  • Automated scheduled cleanup via cron job for hands-free operation
  • Optimized SQL-based cleanup for large log tables with minimal performance impact
Logging Cleanup Module Overview

Main configuration interface

Key Features

Configurable Retention Policies

  • - Set retention days per log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
  • - JSON-based configuration for flexible retention rules
  • - Default retention: DEBUG (3 days), INFO (7 days), WARNING (30 days), ERROR (90 days), CRITICAL (180 days)
  • - Easy configuration through Settings -> Technical -> Logging Cleanup
Retention Rules Configuration

JSON retention rules configuration example

Rotation Modes

  • - Time-Based Rotation: Deletes logs older than retention period per level
  • - Count-Based Rotation: Keeps only the last N records globally (default: 100,000)
  • - Switch between modes easily in settings
  • - Enable/disable cleanup functionality as needed

Automated Cleanup

  • - Scheduled cron job runs daily to clean up old logs
  • - Configurable via Settings -> Technical -> Automation -> Scheduled Actions
  • - Audit logging after each cleanup operation
  • - No manual intervention required once configured
Scheduled Action Configuration

Automated cleanup scheduled action

Performance Optimized

  • - Optimized SQL-based cleanup for large tables
  • - Minimal database load during cleanup operations
  • - Efficient deletion using RETURNING clause for accurate counts
  • - Safe transaction handling with proper commits

Manual Cleanup

  • - Manual cleanup button in Settings -> Technical -> Logging Cleanup
  • - Manual cleanup action in Logs list view
  • - Immediate feedback with notification showing deleted record count
  • - Restricted to users with Technical Settings access

Why You Need This Module

The Problem

  • Odoo's ir.logging table grows indefinitely without cleanup
  • Large log tables can slow down database performance
  • No built-in mechanism to automatically clean old logs
  • Manual cleanup requires direct database access and SQL knowledge
  • Different log levels may need different retention policies

The Solution

  • Automated Cleanup: Scheduled daily cleanup via cron job
  • Flexible Configuration: Set retention policies per log level
  • Two Rotation Modes: Time-based or count-based strategies
  • Easy Management: Configure everything through Odoo Settings UI
  • Manual Control: Trigger cleanup on-demand when needed
  • Performance Optimized: Efficient SQL-based deletion for large tables
  • Audit Trail: Logs cleanup operations for tracking

Installation & Configuration

Requirements

  • - Odoo 19.0+ required
  • - Dependencies: base, base_setup (automatically included)
  • - No additional modules required
  • - Database superuser access for initial setup

Installation Steps:

  1. Place module in addons directory
  2. Update app list in Odoo
  3. Install "Logging Cleanup" module
  4. Go to Settings -> Technical -> Logging Cleanup
  5. Configure retention policies and enable cleanup

Configuration Guide

  • Enable Cleanup: Check "Log Cleanup Enabled" to activate automated cleanup
  • Rotation Mode: Choose "Time-Based" (per level retention) or "Count-Based" (keep last N records)
  • Retention Rules: Configure JSON with retention days per log level
  • Max Records: Set maximum records to keep in count-based mode (default: 100,000)
  • Manual Cleanup: Use "Clean Logs Now" button for immediate cleanup
Logging Cleanup Settings Configuration

Settings -> Technical -> Logging Cleanup configuration page

Usage Examples

Time-Based Rotation Example

  1. Configure retention rules: DEBUG (3 days), INFO (7 days), WARNING (30 days), ERROR (90 days), CRITICAL (180 days)
  2. Enable "Log Cleanup Enabled" and select "Time-Based Rotation"
  3. Cron job runs daily and deletes logs older than their retention period
  4. Each log level is cleaned independently based on its retention rule

Count-Based Rotation Example

  • Set "Max Records to Keep" to 100,000 (or your preferred limit)
  • Select "Count-Based Rotation" mode
  • When total log records exceed 100,000, oldest records are deleted
  • Keeps the most recent 100,000 records regardless of log level

Manual Cleanup

  • From Settings: Go to Settings -> Technical -> Logging Cleanup -> Click "Clean Logs Now"
  • From Logs View: Open Technical -> Logging -> Click "Clean Logs Now" button
  • Immediate cleanup using current configuration
  • Notification shows number of deleted records
Logs List View with Cleanup Button

Logs list view showing the "Clean Logs Now" button

Technical Implementation

Architecture

  • - ir.logging Model Extension: Adds cleanup_logs() method with time-based and count-based strategies
  • - res.config.settings Extension: Configuration UI for retention policies and rotation modes
  • - Scheduled Action: Daily cron job (ir.cron) for automated cleanup
  • - Optimized SQL: Uses RETURNING clause for efficient deletion and accurate counts
  • - Audit Logging: Creates log entries after each cleanup operation

Security & Safety

  • Manual cleanup restricted to users with Technical Settings access (base.group_system)
  • Configuration changes require appropriate permissions
  • Safe transaction handling with proper commits
  • Graceful error handling - cleanup failures don't break the system
  • Audit trail for all cleanup operations

Performance Considerations

  • Uses optimized SQL DELETE statements for bulk operations
  • Minimal database load - cleanup runs during off-peak hours (configurable)
  • Efficient per-level cleanup in time-based mode
  • Subquery optimization for count-based mode
  • No impact on active Odoo operations during cleanup

Report Issues & Contribute

Found a Bug?

If you encounter any bugs or issues with this module, please report them on our GitHub repository. This helps us improve the module for everyone.

  • - Report Bugs: Create a bug report
  • - Request Features: Suggest a new feature
  • - Ask Questions: Get help with questions
  • - View All Issues: Browse existing issues

Contributing

This module is open source and free for the community. We welcome contributions!

  • Submit pull requests with improvements
  • Report bugs and suggest features
  • Help improve documentation
  • Share your feedback and use cases

GitHub Repository: https://github.com/Tecpill/technical_os_odoo_apps

Support

For support and assistance, contact us at admin@tecpill.com

Credits

Authors:
Sayed Mohamed Ebrahim
Technology Pill Business Solution
Company Logo

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with