Adds a read-only audit-logs collection that records create, update, delete, login and logout events across monitored collections and globals. It stores field-level diffs, optional snapshots, actor details and client IP and user agent, while stripping sensitive fields such as passwords and tokens. Registered through the plugin array in the Payload config, it works with Payload 3 and supports retention-based pruning via the Jobs Queue.
Audit trail and activity logging plugin for Payload CMS
Installation
npm i @payload-kit/audit-logs0
Stars
0
Forks
3
Open Issues
Yesterday
Last Updated
517
Weekly Downloads
v0.1.0-alpha.1
npm Version
105.4 KB
Unpacked Size
1
Dependencies
00 since Nov 22
| Date | Stars |
|---|---|
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
| Nov 28, 2026 | 0 |
| Nov 27, 2026 | 0 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
| Nov 24, 2026 | 0 |
| Nov 23, 2026 | 0 |
| Nov 22, 2026 | 0 |
Shared by 5 plugins in gngz/payload-kit.
Trends appear after 7 days of data. Collecting since Dec 2 — 4 daily snapshots so far.
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1474969753-audit-logs)<a href="https://payloaddirectory.dev/plugins/1474969753-audit-logs"><img src="https://payloaddirectory.dev/badge/1474969753-audit-logs.svg" alt="Payload Directory"></a>README
Audit trail plugin for Payload CMS. Adds a read-only audit-logs collection that records create, update, delete, login, and logout events across monitored collections and globals, with field-level diffs, actor metadata, and redaction of sensitive fields.
pnpm add @payload-kit/audit-logs
Peer dependency: payload (^3.0.0).
Register auditPlugin in payload.config.ts:
import { buildConfig } from "payload";
import { auditPlugin } from "@payload-kit/audit-logs";
export default buildConfig({
plugins: [
auditPlugin({
collections: {
orders: { trackDiff: true, trackSnapshot: true },
inventory: { trackDiff: true },
media: { trackDiff: false },
users: {
trackDiff: true,
excludeFields: ["password", "totpSecret"],
},
},
trackAuth: true,
captureMetadata: true,
}),
],
});
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Enables or disables the plugin. When false, returns the config unchanged. |
collectionSlug | string | "audit-logs" | Slug for the generated audit collection. |
adminGroup | false | string | Record<string, string> | undefined | Sidebar group in the Payload Admin panel. |
usersCollectionSlug | string | "users" | Slug of the auth collection used for actor relations and auth hooks. |
collections | string[] | Record<string, AuditCollectionOptions | boolean> | all collections | Collections to monitor. Per-collection options support trackDiff, trackSnapshot, excludeFields, and includeFields. |
globals | string[] | Record<string, AuditCollectionOptions | boolean> | all globals | Globals to monitor. |
trackAuth | boolean | true | Records login and logout events on usersCollectionSlug. |
captureMetadata | boolean | true | Captures client IP and User-Agent headers from the request. |
resolveClientIp | (req: PayloadRequest) => string | null | undefined | x-forwarded-for / x-real-ip | Custom client IP resolver (e.g. Cloudflare cf-connecting-ip or right-most trusted proxy hop). Output is validated as IP. |
globalExcludeFields | string[] | built-in sensitive list | Additional field names redacted across all monitored collections and globals. |
access | { read?, delete?, prune? } | admin-only read, immutable writes | Overrides access control for reading logs, deleting logs, and calling /prune. |
retention | AuditRetentionOptions | undefined | Log retention limits and optional Payload Jobs Queue task. |
By default, @payload-kit/audit-logs resolves client IPs from x-forwarded-for (first entry) and falls back to x-real-ip. Provider-specific headers such as cf-connecting-ip are not read by default to avoid header spoofing outside that provider.
Use clientIpResolvers presets or pass a custom resolveClientIp(req) callback:
import { auditPlugin, clientIpResolvers } from "@payload-kit/audit-logs";
// Behind Cloudflare (`cf-connecting-ip`)
auditPlugin({ resolveClientIp: clientIpResolvers.cloudflare });
// Behind AWS ALB / Nginx / Caddy (1 trusted proxy appending to `x-forwarded-for`)
auditPlugin({ resolveClientIp: clientIpResolvers.forwardedFor({ trustedHops: 1 }) });
// Behind Vercel (`x-vercel-forwarded-for`), Fly.io (`fly-client-ip`), Fastly (`fastly-client-ip`), or a custom header
auditPlugin({ resolveClientIp: clientIpResolvers.vercel });
auditPlugin({ resolveClientIp: clientIpResolvers.header("true-client-ip") });
Configure retention to prune older entries by age (days), total count (maxRecords), or both. Setting job.enabled: true registers a Payload Jobs Queue task and exposes POST /api/<collectionSlug>/prune for manual or webhook runs.
auditPlugin({
retention: {
days: 60,
maxRecords: 10000,
job: {
enabled: true,
taskSlug: "pruneAuditLogs",
cron: "0 3 * * *",
},
},
});
create, update, and delete return false).req through so audit writes share the active database transaction.req.context.skipAudit = true on internal Local API calls when you want to bypass audit logging or avoid recursive hooks.en) and European Portuguese (pt).MIT
payload plugin audit trail
Hash-chained audit trail recording which fields changed, by whom and how, without storing values
74157/wk0v3
payload plugin audit log
Append-only audit log of document, global and auth changes with CSV and NDJSON export
72394/wk37v3
activity log
Record create, update and delete activity on selected collections and globals in a dedicated log collection
87639/wk115v4
payload auditor
Hook-based audit logging for Payload collections and globals with buffered writes and automatic log cleanup
811.4k/wk82v3
payload hooks
Identifier-only audit logging hooks for Payload collections, plus a helper to run callbacks after transaction commit
77225/wk3v3
payload plugin whitehat
Security testing for Payload sites with severity-ranked alerts stored in the site's own database
73295/wk0v3