By recording every change to the data in the system as an event and storing these events in an event log.
The event sourcing pattern works by creating a microservice that is responsible for handling events, and another microservice that is responsible for querying the data.
When a change to the data occurs, the event microservice records the change as an event and stores it in the event log.
The query microservice then uses the events in the log to derive the current state of the data and provide it to client applications.