Audit
Automatic, compliance-ready audit logging plugin for Payload CMS that records an immutable change trail across every collection.
Installation
pnpm add @trieb.work/payload-audit About
payload-audit attaches `afterChange` and `afterDelete` hooks to every collection in your Payload config and writes an immutable `audit-logs` entry for each create, update, and delete. One line of configuration covers all collections, with an opt-out list (`disabledCollections`) for anything you do not want audited. Payload's own internal collections (`payload-jobs`, `payload-preferences`, `payload-migrations`, and so on) are excluded by default to avoid noise and feedback loops. The generated `audit-logs` collection denies create, update, and delete through the API. Entries are only written internally by the plugin with `overrideAccess`, so the trail cannot be edited or removed by users. Each entry records the actor (with an email and name snapshot that survives later user deletion), the document id and title, the action type, the IP address, and the user agent. Upload-enabled collections get dedicated `file_upload` and `file_delete` actions instead of generic create and delete. The plugin targets the logging and accountability requirements of frameworks like NIS-2, CRA, GDPR, HIPAA, PCI-DSS 4.0, ISO/IEC 27001, and SOC 2. Optional forensic metadata captures the auth strategy, HTTP method, request path, and a non-reversible token fingerprint (`<prefix8>:<sha256(rest)>`) so you can correlate every action performed with a stolen credential without persisting the raw token. Delegation and impersonation follow RFC 8693 `act` semantics, recording who acted on behalf of whom via `onBehalfOf` and a nested `delegationChain`. Retention is enforced by a Payload scheduled task registered when you set `maxAge` (days) or `maxEntries` (count), with a configurable cron and queue, or a `disableSchedule` flag for manual triggering. Multi-tenant mode adds a `tenant` relationship to each entry, auto-detects the tenant field on your collections, and interoperates with `@payloadcms/plugin-multi-tenant`. The exported helpers `writeAuditLog`, `resolveDelegation`, `extractTenant`, `resolveDocTitle`, and `pruneAuditLogs` let you emit and manage entries from custom hooks and scripts, and a `skipAuditLog` request-context flag suppresses the automatic entry when you write a more specific one yourself. Requires Payload 3.x with the MongoDB adapter.
Package info
- Package name
@trieb.work/payload-audit- Latest version
1.3.0- Unpacked size
- 227 kB
- License
- MIT
- Weekly downloads
- 31
- Last publish
- Sep 9, 2026
More from trieb-work
View profileSimilar plugins
More in AdminReservation and Booking Manager
Manage reservations and bookings through Payload CMS with conflict detection and scheduling.
SEO Analyzer
Payload plugin that audits page SEO in the editor sidebar with 50+ checks, a dashboard, score history, redirects and IndexNow.
Admin Nav
Customizable Payload admin sidebar with drag-and-drop reordering, per-user preferences, 70+ icons, nested sub-menus, and a visual customizer view.
Block Builder
Visual drag-and-drop block builder that stores Payload block schemas in the database so editors design and publish blocks without code changes.
Admin Theme
A shadcn-styled admin theme for Payload whose accent, radius, font, logo and navigation are configured live from the admin panel.
SEO Plugin
Adds SEO metadata fields with live search-result previews to Payload collections and globals.