This will be a short article, but I wanted to capture the thought nonetheless.
Here’s where I stumbled upon the problem
I’m currently working on a larger project (“Project radar” – an AI-powered opportunity spotting tool for contractors and freelancers). The project has an EventSourcing “core”. I can’t go into much detail about EventSourcing in this article – there’s a lot of literature on it. For example, I can recommend Martin Dilger’s “Understanding Eventsourcing”. I’m not affiliated with Martin in any way – I just bought and read the book and consider it one of the best sources available at the moment. Anyways: I use AI a lot these days for brainstorming, for ideation, and to identify conceptual gaps in my thinking before I even start development. Yesterday, Gemini pointed out that my stack has a potential problem with GDPR, specifically the “right to be forgotten”.
“Right to be Forgotten” vs. “Immutable Event History”
The fundamental principle of EventSourcing is precisely the “immutable” event log. By definition, the database is “append-only”. Manipulations can quickly break the application’s consistency. But this also means that a CustomerAdded(Name="John Doe") event theoretically stays in there forever. Now, in 95% of cases, this problem can be solved quite elegantly with anonymization. You can “traverse” the event store and replace the real customer data without breaking consistency. This corresponds to “anonymizing” in a classic DB: UPDATE Customers Set Name = "xxx" WHERE Name = "John Doe". So, not a major problem.
The Real Hurdle: Backups and Logs
But in my experience, the current state is usually easy to solve anyway. The GDPR problems primarily arise on two levels: logs and backups. And intuitively, I can solve both much more easily in an EventSourcing stack:
Backups – Event Sourcing to the rescue
Since the EventStore is “immutable” by definition, you don’t have to keep multiple snapshots from different points in time to be safe in case of data corruption or loss. If I only back up the “state” (without ES) and a software bug at 7:00 PM on Friday causes me to lose all order data, then one can only hope that a backup from Saturday at 3:00 AM isn’t the only one that exists. So for disaster recovery, you need multiple snapshots from different times. With EventSourcing, this problem doesn’t exist. The latest backup contains all preceding states. Therefore, I only ever need one (current) snapshot, and it usually looks structurally identical to the production DB. It makes no sense to store a backup from 3:00 AM today and a second one from 3:00 AM yesterday. This means the same “cleaning algorithm” works on the snapshot and the live DB. This makes it much easier to ensure that “John Doe” has been removed from all backups (there is only one).
Logs – Data parsimony without compromising diagnostics
Logs are a bit more subtle. The idea here is that the “main log” already exists in the form of the EventStore. Here, every state change is recorded chronologically. This allows for much more data-parsimonious logging because the log can potentially reference the events to bring all the diagnostic data back together. It should never be necessary to write a “customer name” or other personal data into logs. In “traditional” systems, such anonymized logs are a pain in the arse, to be frank. Why? Because you can no longer simply search for data (“Max Müller reported an error” —> first, find the right Max Müller to get his CustomerId, and then search for the IDs in the log). A log viewer that incorporates the EventLog (as a temporary projection) solves this elegantly. And in a “GDPR-forget-me” case, the anonymization also removes all data from the log at the same time.
Conclusion: GDPR compliance with Event Sourcing is easier
Incidentally, Gemini also found the argument convincing. But that doesn’t mean much, considering the tendency towards “sycophancy” in current models (fine-tuned for conversation).
First published on 27 July 2025 on Substack. Original on Substack