Re:Ask HN: How do you implement audit trail for a product?
by emptysea on Friday February 18, 2022 @10:23PM
(#30394151)
How would CDC include information like the user making the change?
Re:Ask HN: How do you implement audit trail for a product?
by shaeqahmed on Friday February 18, 2022 @11:15PM
(#30394385)
A CDC alone wouldn't. You would need to track and store that metadata in an additional database along with transaction ID, so it can be joined with the raw change stream to form a complete audit log.
Re:Ask HN: How do you implement audit trail for a product?
by gunnarmorling on Monday February 21, 2022 @03:52AM
(#30413401)
Wrote about this very approach on the Debezium blog some time ago: https://debezium.io/blog/2019/10/01/audit-logs-with-change-d.... It uses Kafka Streams for enriching actual change events with that transaction-scoped metadata.
In short, IIRC, it looks into the RDBMSs redo log, and turns it into a message stream. You can then stream this into some kind of messaging platform (Kakfa is typical) and then process the data any way you want. Log it, aggregate it, archive it, stick it in another database, or object store, etc...