Insights · Nov 8, 2026 · 4 min read · FAQ

Who changed this? Designing a SaaS audit log customers can trust

An audit log answers who did what, to which record, and when. What to record, what to leave out, how to protect it and what your customers should see.

AUDIT LOGSWho changed what, and when SELLWRIGHT

A customer's admin opens a ticket: a teammate lost access overnight, or the invoice settings changed, and they want to know who did it. If the answer means a developer digging through server logs, they wait a day for a guess. An audit log answers in seconds, as long as you design it early.

How is an audit log different from your application logs?

Application logs help developers run the software; an audit log helps people answer who did what. OWASP's Logging Cheat Sheet files debugging and performance monitoring under operational uses, and audit trails of data changes, deletions and exports under security uses. It notes that audit trails are collected for different purposes, which often means keeping them separate.

Debug logs are noisy and short-lived; an audit log is a short list of named events that anyone can read.

Which events belong in the audit log?

The ones that change who has access, how the account is set up, or where its data goes. OWASP warns that a blind checklist can create "alarm fog", so choose deliberately:

  • Sign-ins, including failures. OWASP says to always log both, and the OWASP Top 10:2025 names logging only successful logins as a failure.
  • Invites, removals and role changes.
  • Settings changes, with old and new values unless the value is secret.
  • Data exports and imports, including downloaded reports.
  • Deletions of records, files and whole workspaces.
  • API keys created and revoked, and the changes each key makes.
  • Billing changes: plan, seats and payment method, recorded as changed, never copied.
  • Acceptance of terms, which OWASP lists among the legal opt-ins to log.

What should each event record, and what should stay out?

Who, what, when and where, the minimum OWASP sets for every entry, plus the result and the tenant. Who is the actor: a member, an API key, support staff or the system; OWASP counts machine users too. What is an action from a fixed list, its target and the fields that changed. When is an ISO 8601 timestamp with its UTC offset, as OWASP's Logging Vocabulary asks; we store UTC and convert for display. Where is the IP address, the user agent and a request ID that links everything one request did.

{
  "id": "evt_9f2c41",
  "occurred_at": "2026-11-03T14:22:05Z",
  "tenant_id": "ws_4821",
  "actor": { "type": "user", "id": "usr_193" },
  "action": "member.role_changed",
  "target": { "type": "membership", "id": "mem_77" },
  "changes": { "role": { "from": "member", "to": "admin" } },
  "result": "success",
  "ip": "203.0.113.24",
  "user_agent": "Mozilla/5.0 (Macintosh)",
  "request_id": "req_8f2c1a"
}

Leave secrets out. OWASP says passwords, session IDs, access tokens, encryption keys, connection strings and payment card data should usually not be logged directly, but removed, masked, hashed or encrypted. Record that a password changed, never the password, and a new key's ID, never the key. Keep personal data to what an investigation needs, and log structured JSON rather than free text: OWASP notes that line breaks in user input can forge entries in unstructured logs.

How do you make the log hard to tamper with?

Make it append-only, keep it apart from the application data and limit who can write to it. The OWASP Top 10:2025 asks for audit trails with integrity controls against tampering or deletion, such as append-only database tables.

  • Write events through one function using its own database role, allowed to insert rows but not update, delete or truncate them. OWASP recommends a separate account used only for writing log data. That role must not own the table: in Postgres, an owner can always alter or drop it and re-grant itself privileges.
  • Copy events to separate read-only storage soon after writing, as OWASP suggests. The Top 10 counts logs stored only locally, without backups, as a failure.
  • Add tamper detection, such as a hash chain: each event stores a hash of its contents plus the previous event's hash, so an edited or missing row breaks every later link. Keep the latest hash elsewhere, since whoever can rewrite the table can rewrite the chain.
  • Detect when events stop arriving, and record who reads the log. OWASP asks for both.

How long should you keep audit events?

For a period you decide before launch, then delete on schedule. OWASP says log data, backups and copies included, must not be destroyed before the required retention period or kept beyond it, and that legal, regulatory and contractual obligations can set that period. Check what your contracts and regulators require, and decide how long events outlive a deleted workspace.

Should customers see the audit log?

Yes, as an activity log for their own workspace, separate from your internal security log. The OWASP Top 10:2025 lists making logging events visible to users or attackers as one way logs leak information, so the customer view is a deliberate subset.

  • Scope every query to the signed-in tenant on the server, so one customer never sees another's events.
  • Gate it behind its own permission, such as audit:read for owners and admins; see roles and permissions in a SaaS app.
  • Show the actor, action, target, IP address and time in the viewer's time zone. Hide error details and fraud signals.
  • Offer filters by person, action and date, plus a CSV export, and log each export as an event.

Failed sign-ins across tenants, denied requests and rate-limit hits stay in the internal log, with alerts your team acts on.

Where to start

List the questions your customers' admins ask most, such as who removed a user or who exported the contacts, and check that one event answers each. Our web app and SaaS development service designs audit logging alongside the data model, or get in touch for a review of what your app records today.

FAQ

Frequently asked questions

What happens to audit events when a user deletes their account?

Usually the event stays and the person's details go. Record actors by an internal ID and look up names when the log is displayed, so an erased user can show as a deleted member. OWASP suggests pseudonymising identifiers where identity is not needed, and notes that IP addresses may count as personal data subject to deletion requests. Check what your contracts and regulators require.

Should the audit log store old and new values?

For roles and settings, yes: a change from member to admin is exactly what the reader wants to see. Skip values for secrets, for free-text fields that may hold personal data and for large documents, where the changed field names are enough. OWASP lists data changes among the optional events, so decide per field what an investigation needs.

Can our logging service be the audit log?

It can hold a copy, but it rarely works as the only one. Log tools are built for searching recent operational data, often with broad team access. An audit log needs a fixed schema, tenant scoping for the customer view, a retention period you set and write access limited to one role. We write to an audit table and forward copies to the log tool.

Should a failed audit write block the user's action?

For the actions that matter most, we write the audit row in the same database transaction as the change, so neither exists without the other. For lower-risk events, queue the write and alert if it fails. OWASP warns that logging failures should not stop the rest of the application running or leak information, so test both paths deliberately.

Do API calls need their own audit events?

Changes made through the API need the same events as changes made in the interface, with the key recorded as the actor. Read-only calls usually belong in request logs instead, unless they touch sensitive data or export it. OWASP lists adding and deleting tokens, access to sensitive data and data exports among the events to log.

Who on our team should be able to read the internal audit log?

As few people as the work needs, reviewed regularly. OWASP says read access to log data should be restricted and reviewed periodically, and that all access to logs should be recorded and monitored, possibly with prior approval. Treat the log as sensitive data, because it can reveal personal details and how your application works.

Next step

Ready for a website that sells?

Book a short call. We will look at your current site, agree what matters most and send a written scope with a fixed quote.

Book a callOr write to hello@sellwrightstudio.com