An audit log your customers can actually use
An audit log has two readers. Your support team uses it to explain what happened. Your customer’s admin uses it to answer their own auditor. Design for the second reader and the first is covered.
6 min read · Last checked
In short
Key points
- Record who did what, to which resource, when, from where, and with what result.
- Scope every query to the customer first, and let no request parameter widen it.
- Keep stable action names so a customer’s saved filters do not break.
- Leave raw before-and-after payloads out of the customer view; they can hold secrets and personal data.
What an event should contain
The minimum useful event has a time, an action name, the resource type and id, the result, who acted (a person, a service, or the system), their IP address for signed-in users, and a correlation id that ties it to a request. TenancyEngine’s customer-facing events carry exactly those fields, and show the actor and IP only for signed-in user actors.
Scoping is the security property
The dangerous bug in an audit log is showing customer A an event from customer B. Make scoping the first filter on every query and give callers no parameter that can remove it. In TenancyEngine an event belongs to an organization when it concerns one of its applications or the organization itself; platform-level events and other organizations’ events are never visible, and a caller who cannot access an organization gets the same 403 as any other caller.
Names that do not change
Customers build filters and alerts on action names such as application.role.update. Treat names as a contract: add new ones, never rename old ones. The catalog endpoint lists the current names, and a filter accepts an exact name or a prefix ending in a wildcard.
Retention and export
Say your retention plainly. A reviewer who needs a year of history should hear that before they sign, not after.
- Pagination uses a cursor, newest first, with up to 200 events per page.
- Export streams CSV or NDJSON, up to 100,000 rows per export.
- The log is readable for the last 90 days by default; older events are outside the window.
What to leave out
Do not expose raw payloads of changes, tokens, or secrets. Do not expose another customer’s staff. Log that a secret was rotated, never its value.
Honest limits
What to know before you rely on this
- Customer-facing events cover the catalog in the docs; member, invite and API-key events are being added as their writers gain an organization link.
- Per-plan retention windows are a follow-up. The default is 90 days.
- The CSV export of the audit log is on Growth and above; the log itself is on every plan.
Questions people ask
Can organization API keys read the audit log?
No. The routes require a signed-in organization admin and refuse organization API keys.
Is the audit log a compliance report?
No. It is evidence a customer can pull. Compliance attestations are separate and are not implied here.
Sources
Keep reading
Try it on the free plan
One app and five customers, no credit card required.