Immutable history

Audit logs

Drop an `audit_trigger()` on a table and every insert, update, and delete is logged with the user, role, operation, old data, new data, and changed fields. Built for SOX, HIPAA, GDPR.

supasheet.audit_logs
today · 482 events
12:42:08UPDATEcrm.dealsd_8a2…Lena Parkadmin
stageProposalNegotiationamount$42,000$48,000
12:38:51INSERTcrm.contactsc_3f1…Rohan Sharmauser
emailpriya@globex.io
11:55:14DELETEcrm.activitiesa_910…Asha Deviadmin
11:22:09UPDATEcrm.dealsd_77c…Mei Chenuser
owner_idAsha DeviMei Chen
What it does

The capabilities you get out of the box.

Capability01

One-line opt-in

`CREATE TRIGGER ... EXECUTE FUNCTION audit_trigger()` and you are done.

Capability02

Full diffs

Old and new JSON snapshots plus the list of changed fields.

Capability03

Failure tracking

Errors are logged with code and message for after-the-fact debugging.

How it works

Three steps from SQL to UI.

  1. 01
    Add the triggerStandard Postgres trigger pointing at the audit function.
  2. 02
    Make a changeInserts, updates, and deletes are captured automatically.
  3. 03
    InspectBrowse, filter, and search audit history by user, date, or record.
example/audit-logs.sql
sql
-- One trigger per operation, all backed by the same function.
create trigger audit_crm_deals_insert
after insert on crm.deals for each row
execute function supasheet.audit_trigger_function();

create trigger audit_crm_deals_update
after update on crm.deals for each row
execute function supasheet.audit_trigger_function();

create trigger audit_crm_deals_delete
before delete on crm.deals for each row
execute function supasheet.audit_trigger_function();

-- Every change lands in supasheet.audit_log as a JSONB diff
-- (old_data, new_data, changed_fields, user_id, role, op).
Get started

Try it on your own Supabase project.

Connect a project, install the Supasheet schema, and your tables are live in minutes.

No credit cardSelf-host or managedMIT licensed