DamienHarper / auditor

auditor, the missing audit log library
MIT License
164 stars 53 forks source link

Custom columns and custom data in the audit tables #160

Open janklan opened 1 year ago

janklan commented 1 year ago

I'm wondering what could be the best approach to being able to store some custom metadata with each record in the audit tables?

Do I need a custom provider? How would I tell Auditor about the new column in the schema? I found a few options (hooking into the AuditEvent, extending DoctrineProvider and so on), but it all feels hacky.

Could you point me in some direction? I'd be happy to then either improve readme, or submit a PR for whoever is interested.

The background for this need is adding a tenant_id column to each audit row so that we can apply row-level security on server-side with PostgreSQL.