In this DBBlue Feature Series video, we explore the Audit Log, one of the PostgreSQL enhancements developed by the PostgreSQL Research and Development Team at Cybrosys Technologies.
DBBlue is a customized PostgreSQL distribution built by modifying the PostgreSQL source code to optimize database performance and administration for Odoo workloads. Instead of requiring database administrators to manually tune PostgreSQL, DBBlue introduces intelligent features that automate common database operations and improve overall efficiency.
In this video, we show how the DBBlue Audit Log records every INSERT, UPDATE and DELETE on the tables you choose. For each change it stores the old and new values, the database user, the client address, and the Odoo user who made the change. It needs no triggers, no extensions and no changes to your Odoo code.
What You'll Learn in This Video
- What DBBlue is and why it was developed.
- Why standard PostgreSQL has no built-in way to answer "who changed this record, and what was it before?"
- How to turn on auditing for specific Odoo tables.
- How to choose which operations are audited (INSERT, UPDATE, DELETE).
- How to read the audit history from the `dbblue.dbblue_audit_log` table.
- How DBBlue records the Odoo user's name as well as the PostgreSQL user.
- How to hide sensitive columns such as passwords or national IDs from the log.
- How to record only the columns an UPDATE actually changed, which keeps the log small.
- How automatic retention removes old audit records on a schedule.
- How to limit auditing to particular databases in a multi-database cluster.
Commands Demonstrated
List available PostgreSQL clusters
pg_lsclusters
Switch to the PostgreSQL superuser
sudo su postgres
Choose the tables to audit
ALTER DATABASE odoo_database SET dbblue_audit_tables = 'sale_order, res_partner, account_move';
Choose which operations are recorded
ALTER DATABASE odoo_database SET dbblue_audit_operations = 'insert, update, delete';
Hide sensitive column values in the log
ALTER DATABASE odoo_database SET dbblue_audit_exclude_columns = 'res_users.password';
Record only the changed columns on UPDATE
ALTER DATABASE odoo_database SET dbblue_audit_changed_columns_only = on;
Keep audit history for 90 days
ALTER DATABASE odoo_database SET dbblue_audit_retention = '90 days';
View the audit history
SELECT rel_name, dml_op, old_data, new_data,
changed_by, odoo_changed_by, client_addr, logged_at
FROM dbblue.dbblue_audit_log
ORDER BY logged_at DESC;
What the Audit Log Records
Each audited change is stored as one row in `dbblue.dbblue_audit_log`. The row holds the table name, the operation, the old and new row data as JSONB, the PostgreSQL user, the session user, the client address and a timestamp. For Odoo databases, DBBlue also stores the Odoo `create_uid` and `write_uid` and looks up the matching Odoo user names at the time of the change. The audit trail therefore stays readable even if a user is later renamed or removed. DBBlue creates the log table automatically on first use. Regular users can read it but cannot insert, update or delete its rows, so the history cannot be forged or edited.
Automatic Retention
Set `dbblue_audit_retention` to an interval such as `90 days`, `6 months` or `7 years`, and a DBBlue background worker deletes audit rows older than that limit. The cleanup runs on a schedule even when nobody is writing to the database, so a quiet database doesn't keep expired history. Rows are deleted in small batches to avoid long locks. The default is `0`, which keeps everything.
Why Audit Log?
Odoo businesses often need to know who changed an invoice, a price or a customer record, and what the old value was, whether for compliance, investigating mistakes or customer disputes. In standard PostgreSQL this means writing and maintaining triggers on every table or installing extra extensions. DBBlue builds auditing into the database engine, so you only name the tables you want tracked and DBBlue records every change, including bulk loads done with COPY.
About DBBlue
DBBlue is an Odoo-optimized PostgreSQL distribution developed by the PostgreSQL R&D Team at Cybrosys Technologies. By enhancing the PostgreSQL source code, DBBlue introduces intelligent features focused on improving performance, administration, backup and restore, indexing, caching, security, and automation specifically for Odoo databases.
Connect With Us:
—————————————
➡️ Website:
https://www.cybrosys.com/
➡️ Email: info@cybrosys.com
➡️ Twitter:
https://x.com/Cybrosys
➡️ LinkedIn:
https://www.linkedin.com/company/cybrosys/
➡️ Facebook:
https://www.facebook.com/cybrosystechnologies/
➡️ Instagram:
https://www.instagram.com/cybrosystech/
➡️ Pinterest:
https://www.pinterest.com/cybrosys/
#Dbblue #DatabaseFeature #AuditLog #DBBlueFeatures #CybrosysTechnologies #DataManagement #DatabaseSecurity #TechTutorial #SoftwareFeatures #businessintelligence