Building Audit Logs in Phoenix Without Exposing Passwords
A developer building audit logging for a Phoenix application found that a basic Ecto-based approach had several flaws. Application-level logging can omit sensitive fields like passwords by filtering virtual fields and associations, but it misses changes made outside the changeset path, such as bulk updates or manual database edits. To capture every modification regardless of how it happened, the author turns to PostgreSQL row-level triggers, which fire on every insert, update, and delete. The trigger approach can record old and new values while excluding secrets such as hashed passwords. The article argues that database-level capture is necessary for a reliable audit trail.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in