H-Studio logo
Start a project
architecture · 15 May 2026 · 12 min

Auditable Architecture: Evidence, Logs and GDPR in Practice

How product teams design reliable audit trails: event scope, integrity, access, retention and GDPR without treating event sourcing as mandatory.

Author
Anna Hartung
  • architecture
  • compliance
  • audit
  • event-sourcing
  • gdpr

Auditable architecture makes relevant activity traceable: which person or service performed which action on what object, when, with what result and in which technical context? The answer must be reliable enough for incident response, internal control, customer assurance or a specific regulatory duty.

This does not mean storing every state change forever in an immutable system. Scope, integrity and retention must match the purpose and risk. An oversized audit trail can itself become a security and privacy liability.

This article covers engineering and security practice, not legal advice. Evidence and retention duties vary by sector, contract, data type and processing activity.

Distinguish audit trails, security logs and observability

The categories overlap but solve different problems:

Data typePrimary purposeExample
Audit trailreconstruct a business or administrative actionrole changed, contract approved
Security logdetect and investigate an attack or policy violationfailed login, suspicious export
Application logdiagnose a technical failuretimeout, exception, retry
Metric and traceobserve system behaviour and performancelatency, queue depth, request trace

They may share infrastructure, but should not automatically share one schema and retention period. A debug log usually has a shorter useful life than a contractual approval record. The OWASP Logging Cheat Sheet explicitly notes that security, process, audit and transaction logs can have different purposes and content.

Start with an evidence matrix

Before selecting an event store, answer these questions for each evidence need:

  1. What specific purpose justifies collection?
  2. Which events are needed to answer it?
  3. Which fields are required rather than merely convenient?
  4. Who may write, read and export the data?
  5. How will tampering be prevented or detected?
  6. How quickly must investigation and export work?
  7. When does the purpose end and how will the data be deleted?

A matrix prevents “compliance” from becoming a vague reason for permanent full-fidelity logging.

PurposeEventsIntegrity needRetentionApproval
Account securitylogin, MFA change, recoveryhighdocumented from risksecurity team
Admin actionsrole, tenant and export changeshighlegal/contract reviewdual control for export
Error analysistechnical failure and retrymediumshort, rotatingengineering
Business evidenceapproval or status changeprocess-dependentdefined per processprocess owner

Concrete periods belong in the matrix but not as universal advice in an architecture article. They must follow applicable obligations and documented need.

Design a useful audit event

An audit event should provide enough context without copying the entire request or record. Typical fields include:

  • stable event ID,
  • event type and schema version,
  • timestamp from a synchronised time source,
  • human or machine actor,
  • tenant and affected object,
  • action and result,
  • correlation or trace ID,
  • source, environment and service,
  • reason or ticket reference for particularly sensitive actions.

Keep secrets out of logs

Passwords, access tokens, session identifiers, private keys and full payment data do not belong in audit logs. Health information, message bodies and other sensitive personal data should not be copied as payload by default.

A stable internal identifier is often enough. Hashing or pseudonymisation can reduce risk but does not automatically make data anonymous. Free-text fields are especially risky because users and developers can place uncontrolled personal data or secrets in them.

Treat events as untrusted input

A crafted username containing line breaks must not create false log entries. Validate, normalise and encode event data for the target format. Limit field lengths and event types. Internal services can also be faulty or compromised.

A reference architecture for audit trails

A robust pipeline commonly has six layers:

  1. Producer: the application creates a typed event where the relevant action becomes final.
  2. Collection: a shared handler or collector validates schema, time and required fields.
  3. Transport: a queue or reliable delivery mechanism decouples the application and central store where the risk model permits it.
  4. Storage: a protected repository accepts events and supports defined search and export.
  5. Detection: rules and alerts identify critical patterns; an unread log does not provide detection.
  6. Lifecycle: archive, restriction and deletion follow the evidence matrix.

Not every product needs Kafka, a SIEM and WORM storage. A smaller application can start with a separate audit table, restrictive database roles, tested backups and monitored exports. The control level should match the potential impact and be tested.

Integrity requires more than “append-only”

An insert-only application API does not prove that a database administrator cannot alter records. Controls may include:

  • separate roles for application, operations and audit review,
  • no update or delete rights for the normal application identity,
  • a copy in a separate security boundary,
  • immutable or time-locked object storage for justified evidence,
  • hash chaining or digital signatures for tamper detection,
  • recorded and alerted access to audit data,
  • regular restore and integrity tests.

The right combination follows the threat model and evidence requirement. “Immutable” should not be only a storage-product label; administrator paths, backups, keys and export procedures are part of the assessment.

Completeness and failure behaviour

The difficult part is often not storage but ensuring that each relevant business result creates the expected audit entry.

Transactions and the outbox pattern

If the business state commits but asynchronous log delivery fails, the trail has a gap. A transactional outbox can store the business change and pending event in the same database transaction. A worker then delivers it. Consumers must tolerate duplicates; a stable event ID supports idempotency.

Fail open or fail closed

What happens if the audit pipeline is unavailable?

  • Blocking a high-risk administrative action may be appropriate.
  • Blocking a public core function can harm availability.

This decision belongs in the threat model. Queue limits, local buffering, alerts and controlled degradation need to be defined before an incident.

Event sourcing is optional

Event sourcing uses domain events as the leading state record. It can provide a detailed business history but adds schema evolution, projections, replay, migration and privacy concerns. An audit trail can be built without event sourcing. For many SaaS products, a conventional state database with a focused audit log is the simpler architecture.

GDPR and retention

Audit logs can contain personal data such as user IDs, IP addresses and actions. The principles in GDPR Article 5 therefore apply, including purpose limitation, data minimisation, storage limitation, integrity and confidentiality. Article 32 requires technical and organisational measures appropriate to risk.

Practical consequences include:

  • document purpose and legal basis per log category,
  • collect only necessary identifiers,
  • restrict log access more strongly than ordinary product access,
  • record exports and review access where appropriate,
  • implement fixed review and deletion processes,
  • include backups and derived SIEM data in the lifecycle,
  • prepare access, erasure and restriction workflows.

The Article 17 right to erasure is not absolute; statutory retention and legal claims can create exceptions. That still does not justify indefinite storage of all audit data.

Do not apply GoBD to every log

Germany's GoBD concern tax-relevant books, records and electronic documents. They do not automatically turn every application or security log into a retained accounting record. Where a system documents tax-relevant transactions, the responsible team and tax advisers should define the exact data set against the current Federal Ministry of Finance GoBD publication.

Test the audit capability

A dashboard full of log lines is not yet reliable evidence. Test regularly:

  • Is every defined high-risk action captured?
  • Are time, actor, object, outcome and correlation correct?
  • Do retries create duplicates or gaps?
  • Can input trigger log injection?
  • Are secrets and unnecessary personal data excluded?
  • Does monitoring detect a pipeline failure?
  • Do search and export meet the required time?
  • Are read and export operations controlled?
  • Does deletion cover archives and backups?
  • Can integrity still be verified after a restore?

A lean implementation sequence

  1. Select five to ten critical actions instead of “everything”.
  2. Create the evidence matrix and a versioned event schema.
  3. Implement a central audit handler with tests.
  4. Separate write, read and export permissions.
  5. Add alerts for pipeline failure and relevant security events.
  6. Define retention and deletion before production.
  7. Run a mock audit: another person reconstructs a real test case using only the intended evidence.

Expand into more processes or more complex storage and SIEM infrastructure only after this core works.

Conclusion

Auditable architecture is not synonymous with event sourcing, Data Vault or indefinite immutable logs. It is a demonstrable chain of deliberately selected events, reliable collection, protected integrity, controlled access and bounded retention.

Good teams begin with the question that an incident or audit must answer. That determines the event, protection, searchability and deletion point. The result provides evidence without becoming another data dump.

Read more

Keep reading

More from the engineering stream.

  1. Post · 001
    23 Jul 2026

    EU AI Act Article 50: Product Checklist Before 2 August 2026

    A practical Article 50 checklist for product and engineering teams: AI disclosures, machine-readable marking, human review, evidence and rollout.

    Read post
  2. Post · 002
    16 Jun 2026

    Fintech Software Development in Germany: Finding an Engineering Partner with BaFin and DORA Context (2026)

    What a fintech engineering partner in Germany must deliver technically in 2026: DORA, BaFin context (MaRisk, BAIT), KYC/AML under the GwG, an audit trail and EU hosting — and when you need a specialist. Engineering perspective, not legal advice. As of June 2026.

    Read post
  3. Post · 003
    09 Jun 2026

    Headless / Next.js Website vs. WordPress for German B2B Companies

    Next.js with a headless CMS or WordPress for your B2B website? An honest comparison of performance, SEO, security, 3-year cost and migration — and when each one is the right call.

    Read post
All posts
Get started ·  011

Let’s build what
moves you forward.

From product idea to production system — we help you define, build and hand over software your team can run.

Studio
H-Studio Berlin
Senior delivery · DACH region
Contact
hello@h-studio-berlin.de
+49 176 41762410
Office
Schmidstraße 2F-K
10179 Berlin