Audit log

The Audit Log module (auditlog) records the operations performed by the users on the data models selected by the administrator: creations, modifications, deletions, and, optionally, consultations. For every logged operation, the module keeps the user, the date, the record, and the old and new value of each modified field.

Unlike the tracking messages of the chatter, the audit log works on any model (including the ones without a chatter), covers all the fields, and can only be consulted by authorized users.

Note

The menus of the module are located under Settings ‣ Technical ‣ Audit. They are displayed in developer mode to the users with the Administration: Settings access right.

Audit rules

A rule defines which operations are logged for a model. There can only be one rule per model.

Go to Settings ‣ Technical ‣ Audit ‣ Rules, click New, and fill in the fields:

  • Name: the name of the rule;

  • Model: the model to audit (e.g., Contact or Product);

  • Type:

    • Full log: the data of the record is compared before and after the operation. The log also contains the computed fields that changed as a consequence of the operation, but the operation is slower;

    • Fast log: only the values sent by the create and write operations are logged. The log contains less information, but the impact on performance is lower;

  • Log Reads, Log Writes, Log Deletes, Log Creates: the operations to log. All of them are enabled by default, except Log Reads;

  • Capture Record: displayed for a Full log rule with Log Deletes enabled; tick it to keep the field values of the deleted records in the log;

  • Users to Exclude: the users whose operations are not logged (e.g., a technical user running an integration);

  • Fields to Exclude: the fields of the model that are left out of the log.

Then, click Subscribe to start logging. The rule moves to the Subscribed status, and its fields become read-only. To modify or stop a rule, click Unsubscribe first; the logs already recorded are kept.

Warning

Logging has a cost: every logged operation creates additional records. Avoid Log Reads and Full log rules on models with heavy traffic (e.g., journal items, stock moves, or messages), and enable the automatic clean-up.

screenshot: general-audit-log-rule
menu
Settings ‣ Technical ‣ Audit ‣ Rules ‣ New (developer mode)
shows
An audit rule form in the Draft status with the Subscribe button, the model "Contact", the type "Full log", the excluded users and fields, and the four Log checkboxes (Reads unticked, the others ticked).
highlight
The "Subscribe" button and the four "Log ..." checkboxes (red frames).
data
Rule "Contacts audit"; Users to Exclude "OdooBot"; Fields to Exclude "Last Updated on".
module
auditlog
notes
English UI, light theme, 1440px width, developer mode enabled.

Consult the logs

From a record

As soon as a rule is subscribed, a View logs entry is added to the Action menu of the audited model. Open a record (or select it in the list view), and click Action ‣ View logs to display the operations logged for that record.

This entry is the only access to the logs for the users who belong to the Auditlog User group without being administrators.

From the Audit menu

  • Settings ‣ Technical ‣ Audit ‣ Logs lists all the logged operations with their date, User, Model, Resource Name, Resource ID, and method (create, read, write, or unlink). Open a log to see the Fields updated list, with the technical name and the description of each field, and its old and new value. The list can be grouped by user, model, record, date, user session, or HTTP request.

  • Settings ‣ Technical ‣ Audit ‣ Log Lines lists the field changes of all the logs in a single list, grouped by model. It is the most convenient view to follow the successive values of one field.

  • Settings ‣ Technical ‣ Audit ‣ User sessions and Settings ‣ Technical ‣ Audit ‣ HTTP Requests list the sessions and the requests during which logged operations took place, with the user, the path of the request, and the related logs. They help to reconstruct what a user did during one session.

screenshot: general-audit-log-log-form
menu
Settings ‣ Technical ‣ Audit ‣ Logs ‣ (open a "write" log)
shows
A log form with the Log group (date, user, method "write", type, model, resource ID and name), the HTTP Context group, and the "Fields updated" list showing two fields with their old and new values.
highlight
The "Fields updated" list (red frame).
data
Contact "Deco Addict": Phone changed, Salesperson changed from "Marc Demo" to "Mitchell Admin".
module
auditlog
notes
English UI, light theme, 1440px width.

Access rights

The module adds the Auditlog Rights category to the access rights of the users, with two levels:

  • Auditlog User: read-only access to the logs, through the View logs action of the audited records;

  • Auditlog Manager: in addition, can create, modify, subscribe, and delete rules, and delete logs. Users with the Administration: Settings access right are automatically managers.

Automatic clean-up of old logs

The Auto-vacuum audit logs scheduled action deletes the logs, the log lines, the user sessions, and the HTTP requests older than 180 days. It is disabled by default.

To enable it, go to Settings ‣ Technical ‣ Automation ‣ Scheduled Actions, open Auto-vacuum audit logs, and turn on the Active toggle. To keep the logs for a different period, change the number of days in the code of the action, e.g., model.autovacuum(365) for one year.