Data retention
Personal data is deleted automatically once it is older than a period: the email log, the audit log, the error log and security alerts, payments, uninstall backups, request protection's stored answers, the trash, and the modules' data: form submissions, contact messages, appointments, orders and the analytics module's counts. Admins see and change the periods in Settings → Data retention.
What a user can do
- Admins: see every kind of data with its period, default and minimum, and change a period (never below the minimum). Fixed periods (recognising a visitor, request protection) are shown but can't be changed.
- Admins: check what the next clean-up would delete, per kind, and clean up now instead of waiting for the hourly job.
- Editors don't see the Settings screen.
| Action | Permission | Roles |
|---|---|---|
| See the periods | settings.read | admin |
| Change a period | settings.update | admin |
| Check what the next clean-up deletes | settings.read | admin |
| Clean up now | settings.update | admin |
Screens
Settings → Data retention (a card below the site settings, saved on its own with Update retention): one number field per kind, in days, with "Default N days, at least M." under it. The kinds are grouped by where they come from: SHADE's own first, then each module's under its name (Analytics, Appointments, Shop…), fixed periods last in their group. The defaults follow Dutch law, which is the default for Dutch setups; a business elsewhere follows the law where it operates, and periods per country are still to be built. Toast Retention saved; a period below the minimum shows the server's message under the field.
Check what goes puts a badge next to every kind: Nothing to delete or N to delete, by the saved periods. Clean up now asks first ("Everything older than its period is deleted now … This cannot be undone.") and then says how many records went.
Rules and limits
| Kind | Key | Default | Minimum | Counted from |
|---|---|---|---|---|
| Email log | email-log | 90 | 7 | sending |
| Blocked email addresses | email-suppressions | 365 | 30 | the last bounce or complaint |
| Audit log | audit-log | 730 | 180 | the entry (failed sign-ins included) |
| Error log and security alerts | error-log | 30 | 7 | when an error group last happened; refused-action counts and alerts from when they were recorded (Errors and security alerts) |
| Form submissions | forms.submissions | 365 | 30 | sending (Forms, a module) |
| Appointments | appointments.appointments | 365 | 1 | the end of the appointment; a booking the visitor didn't confirm goes an hour after it was made |
| Build hook log | build-hook-deliveries | 90 | 7 | the call of the build hook, the site's and other frontends'; each one's newest is always kept (Builds) |
| Orders | commerce.orders | 2557 (7 years) | 2557 | the order (its lines go with it), not before its newest invoice is as old |
| Orders never paid | commerce.unpaid-orders | 90 | 30 | the order; only failed, expired or cancelled orders without a payment |
| Payments | payments.paid | 2557 (7 years) | 2557 | the payment; only paid ones |
| Payments never paid | payments.unpaid | 90 | 30 | the payment; abandoned, failed or expired checkouts |
| Backups of uninstalled modules | plugin-backups | 90 | 7 | the uninstall |
| Webhook delivery log | webhook-deliveries | 30 | 7 | the delivery (Webhooks) |
| Channel delivery log | channel-deliveries | 30 | 7 | the delivery (Channels) |
| Notifications sent | notifications | 30 | 7 | the time it was due; planned ones are never deleted |
| Finished background jobs | queue-jobs | 7 | 1 | when the job finished, done or given up |
| Events | events | 7 | 1 | when it happened; kept longer while one of its deliveries still waits |
| Consent receipts | consent-receipts | 1095 (3 years, fixed) | — | the visitor's choice (Consent banner) |
| Fiscal records (invoices, credit invoices) | fiscal-records | each record's own date: seven years from the end of the year it was issued (the Dutch term, the default for Dutch setups) | — | the year it was issued (Privacy) |
| Accepted terms (a shop's terms, a booking's consent) | terms-acceptances | 2557 (7 years) | 730 (2 years) | when they were accepted (Privacy) |
| Request protection: stored answers | request-protection | 1 (fixed) | — | the stored checkout answer (rate-limit counts expire on their own) |
| Expired API tokens | expired-tokens | 90 | 1 | the day the token expired |
| API tokens' recent calls | token-requests | 30 | 7 | the call (at most 10,000 per token are kept, the newest) |
| Expired sign-ins of team members | expired-sessions | 1 | 1 | when the session or sign-in code expired (they hold an IP address and a browser) |
| Expired website sign-ins | expired-account-sessions | 1 | 1 | when a visitor's session or sign-in code expired |
| Old versions of pages and entries | versions | 730 | 30 | the version (never the latest or the published one, nor one the editorial module's release, schedule or review waits to publish) |
| Trash | trash | 30 | 1 | when the entry or media item was deleted; one that something in the trash still uses waits for a later run; until it goes it counts toward the usage limits (Trash) |
| Finished imports of entries | import.imports | 30 | 1 | when the import ended: its result and the rows it could not import, with what the file held for them (Import and export, a module); one still running stays |
- The clean-up runs every hour by itself, as part of the instance's background work. Each kind is cleaned up on its own: a kind that fails is logged and the others still run.
- A module's kinds are cleaned up also while the module is switched off.
- What a module keeps in its kv under one of its kinds goes when it was not written within the kind's period; keys a module set to expire go once they have. Both are cleaned up every 15 minutes.
- Stored periods below a kind's minimum (for example after a module raised it) count as the minimum.
- Check what goes runs every kind's clean-up and then undoes it: the counts are exact and nothing is deleted. Like
Clean up now it is for admins (
settings.update): it really runs every clean-up, modules' too, so it is no read. Clean up now does the same as the hourly clean-up, audited as the admin.
Audit entries
| Action | When | Summary |
|---|---|---|
settings.update (target service retention) | a period changed | Changed how long data is kept (meta: old and new periods) |
retention.purge (target retention, id the kind) | a clean-up deleted something | Deleted N records of |
The hourly clean-up's entries show System under Who and Through.
For developers
The code and its tests: shade/features/retention/README.md in the shade repository.