Auditing App
The auditing app tracks every change in the Maybern system, providing a complete audit trail for compliance, debugging, and rollback capabilities.Overview
Auditing operates at two levels:- API Layer - Captures which API endpoint was called
- Database Layer - Captures what data changed
API Layer Auditing
The shared API decorators (@api_get, @api_post, etc.) automatically create APIAuditLogEntry records:
GET requests do not generate audit entries since they don’t modify data.
Database Layer Auditing
Changes to models are tracked via custom managers. When a model is saved, updated, or deleted, aModelAuditLogEntry is created with a diff.
Enabling Auditing
All models inheriting fromCustomerTimeStampedModel or TimeStampedModel are audited by default. To disable:
Diff Examples
- Create
- Edit
- Delete
Internationalization (i18n)
Audit data is stored with i18n keys so it can be displayed in any language:User-Generated Data
Stored as-is (names, descriptions, comments)System-Generated Data
Stored as i18n keys:- API Operation IDs
- Model field names
- Enum values
Validation
Tests ensure all auditable fields, operation IDs, and enums have corresponding i18n keys:Models
| Model | Description |
|---|---|
APIAuditLogEntry | Records API endpoint calls |
ModelAuditLogEntry | Records model changes with diffs |
Use Cases
Debugging
Debugging
Trace what happened:
- Find the API request that caused an issue
- See all model changes from that request
- Compare before/after states
Compliance
Compliance
Answer auditor questions:
- Who made this change?
- When was it made?
- What was the previous value?
Support
Support
Help customers understand changes:
- Show change history in the UI
- Explain what happened and when