Privacy by Design and Default Questions
Designing privacy into products, architectures and the software development lifecycle instead of bolting it on afterward. Covers the privacy-by-design principles and privacy-protective defaults, data minimization and purpose limitation at design time, personal-data flow mapping and PII inventory for a feature, consent and preference design including consent storage, enforcement across web and mobile and region-specific consent flows, retention and deletion design including legal holds, deletion across backups and immutable logs, provable deletion, and data-subject access, export and erasure flows, PII-safe logging, telemetry and session replay, on-device processing to limit data exposure, privacy-versus-personalization trade-offs, privacy in ML training data, feature stores and erasure from trained models, and privacy review gates, checklists, CI/CD checks, release readiness and requirements traceability inside engineering workflows. Includes designing privacy-first features, reference architectures, remediating privacy design flaws and rollout programs across product teams, and working with product, legal and security partners. Cryptographic and statistical privacy techniques, formal impact assessments, data-protection law, cross-border transfer rules, vendor risk, and encryption or access-control mechanics are covered elsewhere.
Design a consent-aware analytics pipeline that ingests events from mobile app, web, and server logs, using streaming (Kafka) and batch (Spark). Requirements: maintain current consent state with versioning, enforce opt-ins and opt-outs so processing respects consent changes (including retroactive opt-outs where applicable), scale to millions of events per minute, and produce audit logs showing enforcement. Sketch components and enforcement mechanisms.
Sample Answer
Direct answer
Treat consent as a versioned, keyed table that the stream processor joins against in real time, keep a full consent history so batch jobs can join on event time, split output by purpose so one consent never leaks into another use, and write an enforcement audit trail. The core idea is one join: every event is checked against the consent that applied to that user and purpose when the event happened. Everything else is plumbing that keeps the join fast, correctly ordered and provable. The streaming pieces use Kafka (a distributed event log: producers append messages to named topics and consumers read them in order) and Spark (a distributed batch processing engine).
One event, start to finish
User u1 opens the app. The gateway stamps the event with purpose analytics and event_id e1, and it lands in the raw-events topic. The enforcer already holds u1's latest consent in memory (analytics: granted, notice version 3), so it does a local lookup, sees granted, writes e1 to the analytics-allowed topic and appends an audit row (e1, allow, consent v3, rule v7). Next week u1 revokes analytics. The consent service writes a new record, the enforcer updates its in-memory copy, and the next analytics event from u1 is denied: its payload is dropped, and only a counter and an audit row remain.
Components
mobile / web / server logs
-> ingestion gateway (validate, stamp purpose + event_id)
-> Kafka raw-events topic (keyed by user_id)
consent service -> Kafka consent-changes topic (compacted: one record kept per user + purpose; partitioned by user_id)
-> stream enforcer: raw events joined with local consent state
-> analytics-allowed topic -> analytics store
-> marketing-allowed topic -> marketing store
-> denied: payload dropped, counted
-> audit log (decision, consent version, rule version)
Spark batch: replays raw events against consent HISTORY (read from the consent service's append-only event store, since the compacted topic keeps only the latest record per key)
Streaming enforcement
- Partition both topics by user ID. A topic is split into partitions (independent ordered lanes), and messages that map to the same partition are read in the order they were written. Give both topics the same partition count and partition on user_id alone (the consent topic is still compacted per user + purpose, meaning the topic keeps only the latest record for each key, so it behaves like a table of current consent). Kafka's default partitioner hashes the whole message key, so if the consent record's key is user + purpose you need a custom partitioner that hashes only the user_id part, or the two lanes will not line up. Then u1's revocation and u1's next event sit in partitions with the same number and are read by the same enforcer task, so all of u1's state lives in one place. If the topics were not co-partitioned, the revocation could sit on an instance that never sees u1's events, and the enforcer would allow them after the user had already revoked. Co-partitioning does not by itself order the two topics against each other, because Kafka orders messages only within one partition. Across the two inputs, a stream processor such as Kafka Streams takes the buffered record with the smaller timestamp first and can wait briefly for a lagging input (the max.task.idle.ms setting), which is best effort only. A revocation still in flight when an event is processed can therefore lose the race, which is why the batch replay on event time described below is the correction path, and why each audit row records the consent version that was actually applied.
- The enforcer holds consent state locally in a state store (an in-memory table that is also written to a changelog topic, so after a crash it is rebuilt by replaying that topic), so each event is a local lookup, not a remote call. That is how it stays fast at millions of events per minute: for example 5 million events a minute is about 83,000 per second, spread across partitions you size from measured per-partition throughput.
- Exactly-once (every message changes the result precisely one time, even across retries) is hard to guarantee across many systems. At-least-once delivery means a message can arrive twice after a retry but is never lost. So use at-least-once and deduplicate on
event_idat the sinks: a sink that has already storede1ignores a second copy, so a replay cannot double count.
Consent-version join and time-versioned consent (runnable)
Each decision keeps its notice version and effective time. An event is allowed only if the latest decision at the event's time is a grant for that purpose and the version is current enough.
import sqlite3
db = sqlite3.connect(":memory:")
db.executescript("""
CREATE TABLE consent_event (event_id INTEGER PRIMARY KEY, user_id TEXT, purpose_id TEXT,
decision TEXT, consent_version INTEGER, occurred_at TEXT);
CREATE TABLE events (event_id TEXT, user_id TEXT, purpose_id TEXT, event_ts TEXT);
""")
db.executemany("INSERT INTO consent_event(user_id,purpose_id,decision,consent_version,occurred_at) VALUES (?,?,?,?,?)", [
("u1","analytics","granted",3,"2026-01-01T10:00:00Z"),
("u1","analytics","revoked",3,"2026-02-01T09:00:00Z"),
("u2","analytics","granted",3,"2026-01-05T08:00:00Z"),
("u2","marketing","revoked",3,"2026-01-06T08:00:00Z"),
("u3","analytics","granted",2,"2025-11-01T08:00:00Z"),
("u5","analytics","granted",3,"2026-01-01T08:00:00Z"),
("u5","analytics","revoked",2,"2026-02-01T08:00:00Z")]) # revoked on a device showing notice v2
db.executemany("INSERT INTO events VALUES (?,?,?,?)", [
("e1","u1","analytics","2026-01-15T00:00:00Z"), # before revocation
("e2","u1","analytics","2026-02-10T00:00:00Z"), # after revocation
("e3","u2","analytics","2026-02-10T00:00:00Z"), # granted
("e4","u2","marketing","2026-02-10T00:00:00Z"), # marketing revoked
("e5","u3","analytics","2026-02-10T00:00:00Z"), # old notice version
("e6","u4","analytics","2026-02-10T00:00:00Z"), # no record at all
("e7","u5","analytics","2026-02-10T00:00:00Z")]) # revoked on an older notice: still a revocation
MIN_VERSION = 3
as_of = """SELECT ev.event_id FROM events ev WHERE
(SELECT c.decision FROM consent_event c
WHERE c.user_id=ev.user_id AND c.purpose_id=ev.purpose_id
AND c.occurred_at<=ev.event_ts
ORDER BY c.occurred_at DESC, c.event_id DESC LIMIT 1)='granted'
AND (SELECT c.consent_version FROM consent_event c
WHERE c.user_id=ev.user_id AND c.purpose_id=ev.purpose_id
AND c.occurred_at<=ev.event_ts
ORDER BY c.occurred_at DESC, c.event_id DESC LIMIT 1)>=? ORDER BY 1"""
current = """SELECT ev.event_id FROM events ev WHERE
(SELECT c.decision FROM consent_event c
WHERE c.user_id=ev.user_id AND c.purpose_id=ev.purpose_id
ORDER BY c.occurred_at DESC, c.event_id DESC LIMIT 1)='granted'
AND (SELECT c.consent_version FROM consent_event c
WHERE c.user_id=ev.user_id AND c.purpose_id=ev.purpose_id
ORDER BY c.occurred_at DESC, c.event_id DESC LIMIT 1)>=? ORDER BY 1"""
print("as-of-event-time:", [r[0] for r in db.execute(as_of, (MIN_VERSION,))])
print("current state :", [r[0] for r in db.execute(current, (MIN_VERSION,))])
Output:
as-of-event-time: ['e1', 'e3']
current state : ['e3']
In words, the as-of query takes each event, looks at that user's decisions for the same purpose that were made at or before the event time, picks the newest one whatever notice version it carries, and keeps the event only if that decision is a grant and its notice version meets the minimum. The order matters: filtering by version first would skip a revocation recorded on an older notice and let events through, which is what e7 tests. The current-state query is identical except it drops the "at or before the event time" condition, so it uses the newest decision ever made. That single condition is the difference between the two output lines.
e1 passes (granted then, revoked later). e2 fails (after revocation). e4 fails (marketing revoked). e5 fails (older notice version). e6 fails (no record). e7 fails (the user's latest decision is a revocation, even though it was made on notice version 2). That is default deny. The second line shows the stricter retroactive reading, discussed next.
Retroactive opt-outs and late events
- Late events: join on event time with a watermark (the point after which later events are treated as late), and rerun in batch against the history if consent changed meanwhile. Example: a phone offline for an hour sends an event stamped 08:59, and it arrives at 10:05, after u1's 09:00 revocation was applied. With a 10-minute watermark the live enforcer has already moved on, so it routes the event to a late topic, and the batch replay judges it as of 08:59 against the consent history (granted then).
- Retroactive opt-out is a policy choice. Stop future processing at once. Then either delete or exclude the user's past rows (as the current-state query does) or keep them only in aggregates. Aggregated cohorts can stay if no individual rows remain; counsel decides whether they count as anonymous.
Preventing leakage between purposes
Analytics opt-in does not allow marketing. Separate topics, stores and service accounts per purpose, and a canary test user (a fake account created for the test) with analytics on and marketing off that must never appear in the marketing sink. Where identity is not needed, key the data by a pseudonymous ID (a keyed hash held outside the analytics team); it is still personal data, and revocation can also delete the mapping.
Audit evidence
Log each decision with event ID, consent version, rule version and result into append-only storage, partitioned by day. Every denial gets its own audit row (the denied payload itself is still dropped, as above). The walk-through shows one audit row per allowed event; at millions of events per minute, allowed decisions may instead be aggregated per window with counts, provided the policy for that is agreed with the auditor.
Customer data collected for one purpose is tempting to reuse for an unrelated analysis. How would you let teams get value from it while stopping quiet repurposing, in both process and code?
Sample Answer
Direct answer
Make purpose a property the data carries, then give teams a fast, visible path to a compatible reuse so the quiet path is not the easy one. Purpose limitation means data collected for a stated purpose is not used for an unrelated one without a fresh basis (a new legal ground for the new use, such as the user's consent to it).
Process
- Purpose registry. Every dataset is tagged with the purposes it was collected for, in the data catalog (the inventory of what data exists and where). An entry might read:
orders| collected for fulfilment, billing | approved later: fraud_detection | owner: payments team. - Reuse request. A short form: dataset, new purpose, who sees the output. The review applies the compatibility factors in GDPR Article 6(4): the link between the purposes, the context of collection and the relationship with the user, the nature of the data (special categories, such as health data, raise the bar), the consequences for users, and safeguards such as pseudonymization (replacing the identifier with a code so rows no longer name the person, though the data is still personal) or aggregation. Worked example: marketing asks to use
ordersto train a model that suggests products. The link to fulfilment is weak, customers bought expecting delivery, not profiling, and the data is ordinary rather than special-category. The consequence is mild (suggestions), and a safeguard exists (drop names and addresses). That reads as allowed with safeguards, plus a notice update. The same request against health-related purchases would be denied or sent for fresh consent. - Four outcomes: allowed as compatible; allowed with safeguards (aggregate, pseudonymize, drop columns); needs a new notice or fresh consent; denied. The reviewer is a named privacy engineer with a response-time target, so the process is not a place where requests die.
- Value path. Aggregated or derived datasets approved for analysis are published for teams to use freely.
Joining datasets
A join can re-identify people even if each table is safe alone. Before approving a join, count how many rows are unique on the quasi-identifiers (fields that identify in combination, such as postcode, birth year, gender). A row that is alone in its group can be matched to a named person by anyone who knows those three facts about them, for example from a purchased list, so the join would re-identify that person.
Code: enforcement in the access layer
from collections import Counter
# Purposes each dataset was collected for, and the purposes later approved by review
DATASETS = {
"orders": {"collected_for": {"fulfilment", "billing"}, "approved": {"fraud_detection"}},
"app_logs": {"collected_for": {"debugging"}, "approved": set()},
}
def check_access(dataset, purpose):
d = DATASETS[dataset]
if purpose in d["collected_for"] or purpose in d["approved"]:
return "allow"
return "deny: file a purpose-compatibility review"
print(check_access("orders", "billing"))
print(check_access("orders", "fraud_detection"))
print(check_access("orders", "marketing_model"))
print(check_access("app_logs", "churn_analysis"))
# Uniqueness check before joining two datasets on quasi-identifiers (zip, birth_year, gender)
rows = [("94107",1990,"F"),("94107",1990,"F"),("94107",1985,"M"),
("10001",1992,"F"),("10001",1992,"M"),("60601",1979,"F")]
groups = Counter(rows)
unique = sum(1 for r in rows if groups[r] == 1)
print("rows:", len(rows), "unique on quasi-identifiers:", unique, "smallest group:", min(groups.values()))
Output:
allow
allow
deny: file a purpose-compatibility review
deny: file a purpose-compatibility review
rows: 6 unique on quasi-identifiers: 4 smallest group: 1
In the tiny example, 4 of 6 rows are unique on the quasi-identifiers (the smallest group has size 1, meaning someone is alone in their combination), so that join would need aggregation or coarsening (for example birth decade instead of year) first. In production the same check sits in the warehouse (purpose-scoped views or tags enforced by access policy), and queries log the declared purpose.
Trade-offs
Too strict and teams copy data out of band; too loose and the tags mean nothing. Measure the review turnaround and the share of requests approved with safeguards.
A user deletes their account. Design how erasure reaches production databases, queues, the data lake, analytics outputs, caches, search indices and backups, including third parties, and how you handle failures along the way.
Sample Answer
Short answer. Make erasure an event that fans out from one orchestrator. Each store gets a deletion step with a defined mechanism, every step is idempotent (running it twice is safe), progress is tracked per store, and the request is only closed when every step that can run has confirmed, including every third party. Backups are the one store with nothing to run: they carry a dated expiry instead. Restores replay the deletion list before data is served.
Orchestration
- The user confirms. The account is locked and a deletion request is written with a request id.
- A workflow engine reads a registry of stores and runs the steps in dependency order.
- A minimal ledger entry (an append-only record holding a keyed hash of the user id, not the id itself) is kept so that late events, restores and re-imports cannot bring the person back.
- State per store: pending, done, failed, waiting_on_third_party, scheduled_expiry (for backups: no action to run, only a recorded date). The request closes when none are pending, failed or waiting; scheduled_expiry entries stay on the record with their dates until the date passes.
Store by store
| Store | How erasure reaches it |
|---|---|
| Production databases | delete in foreign-key order (rows that point to another table first, then the row they point to) inside a transaction (all-or-nothing), or via a stored procedure (a saved database routine) that cascades the deletes. Idempotent, with referential integrity (no row left pointing at a missing row) preserved: set author fields to a placeholder for content others rely on |
| Queues | messages in flight are filtered by the consumer against the suppression list (the keyed ids of deleted users, so any late message for them is dropped); dead-letter queues are purged; short queue retention bounds the rest |
| Data lake and warehouse | table formats that support row-level deletes (Delta Lake and Apache Iceberg are examples), plus compaction and cleanup, meaning a job that rewrites data files without the deleted rows and then removes the old files, so the data is physically gone and not merely hidden; raw files older than the retention window expire |
| Analytics outputs | user-level extracts and feature tables are regenerated or deleted; aggregates over many people may stay |
| Caches | delete the key, plus short TTLs (time-to-live) as the backstop |
| Search indices | delete by document id; confirm after segment merges (the index periodically rewrites its internal files, which is when deleted documents really disappear) and on replicas |
| Backups | expire on rotation; restore procedure replays the ledger before traffic |
| Third parties | call each processor's deletion API; record the acknowledgement; notify other recipients (GDPR Art. 19 asks for this unless impossible or disproportionate) |
Failures. Retry with backoff; after repeated failure raise a ticket with an owner and deadline; the user-facing status stays "in progress". Deleting an already-absent record is success, which makes retries safe.
Variations by jurisdiction. Different US state laws and the GDPR differ in deadlines, exceptions and who must be notified. Make these policy data (a table of country to response_days, extension_days and exceptions) rather than code branches, and counsel maintains them. The same table can hold product settings such as the undo-window length, because that window counts toward the response deadline. For the user, the disruption of deleting is reduced by an undo window, a data export offer, subscription cancellation before deletion starts, and clear timeline messaging.
Proof for a regulator. An audit record per request: request id, store, time, outcome, no personal data in it. Plus the synthetic-user test and restore drills. A worked case: user 4821 deletes; the database step succeeds on day 1, search on day 2, the analytics vendor acknowledges on day 9, backups age out by day 36; the request shows complete on day 9, with the backup entry in scheduled_expiry and its date (day 36) recorded, and the audit record is closed out when that date passes.
Your product keeps authentication logs, transaction records and marketing analytics indefinitely. How would you set a retention period for each, what drives the difference, and how do you make sure deletion actually happens?
Sample Answer
Direct answer
A retention period is the answer to "how long do we have a valid purpose for this data?", not a round number. For each data class I identify the purpose, the legal or contractual minimum that forces us to keep it, and the operational need, then keep it for the longest justified of those and no longer. Deletion only counts when it is automated and verified. The periods below are illustrative starting points; the legal minimums are set by counsel or the relevant regulation for your jurisdiction.
Decision approach
- Purpose: why do we hold it? (Purpose limitation: data collected for one purpose should not linger because it might be useful for another. For example, login IP addresses collected to detect account takeover should not be kept to build ad audiences.)
- Legal and contractual floor (the minimum time a rule forces us to keep it): is there a rule that requires us to keep it (tax, accounting, sector law)? For instance, many countries' tax rules require invoices to be kept for a set number of years, and the number differs by country. Counsel confirms.
- Operational need: how long is it useful for debugging, fraud, security investigation or support?
- Set the period at the longest of the justified inputs, then decide the end state: delete, or aggregate into data that is no longer about individuals.
The three data classes
| Data | What drives the period | Illustrative approach |
|---|---|---|
| Authentication logs (logins, failures, IPs) | Security investigation and fraud detection, not business reporting | Keep raw logs for a short window that covers typical investigation lag, for example 90 days in searchable storage; keep summarized security counters longer. |
| Transaction records | Legal and accounting obligations, plus dispute handling | Keep for the legally required period set by finance and counsel (often multiple years), restrict access, then delete. Do not extend it for analytics convenience. |
| Marketing analytics | Value fades fast, and consent often governs it | Keep event-level data for a short window, for example 13 months to compare year over year, then aggregate and drop user-level identifiers. Delete sooner if consent is withdrawn. |
Making deletion actually happen
- Mark it at write time: store a
created_atand a data-class tag, so an expiry can be computed instead of guessed. - Automate: time-to-live (TTL, automatic expiry) settings on log stores and object storage, and a scheduled job for database rows.
- Cover copies: replicas, search indexes, the data warehouse and backups. Backups usually cannot be edited, so document that they age out on their own schedule and that restored data is re-purged.
- Verify: the job emits a count of rows deleted, and a periodic check queries for records older than the limit plus a grace margin sized to how often the purge job runs (for a nightly job, one day) and expects zero, so that rows merely waiting for the next purge do not raise a false alarm. Plant a test record with an old date and confirm it disappears.
- Own it: each data class has a named owner and the retention schedule lives in version control with a review date.
Worked example
Transaction records: purpose is billing and disputes; the floor is whatever finance and counsel confirm, say 7 years for invoices (illustrative; 7 x 365 = 2,555 days); the operational need is dispute handling, say 1 year; the longest justified input wins, so 7 years, then delete. The nightly check is "count of transaction rows older than 7 years plus 30 days", expected 0. Marketing analytics: purpose is product and campaign insight, floor none, operational need is comparing this month with the same month last year, so 13 months (12 plus one month of slack), then aggregate; the check is "count of event rows with a user identifier older than 13 months plus 1 day", expected 0.
Auth logs: purpose is security, floor is none, operational need is investigations that surface within about a month, so a 90-day raw window gives a safety margin of 60 days over 30 days. The verification query "count of auth log rows older than 91 days" (90 days plus one day of grace for the nightly purge) should return 0 every night; a non-zero result pages the owner.
Pitfalls
A policy on paper with no deletion job; one blanket period for all data; forgetting derived copies; and keeping data "in case" with no named purpose.
Production logs keep accidentally capturing emails, tokens and user identifiers. What controls would you put in place to stop it at the source and catch what slips through, without losing the ability to debug incidents?
Sample Answer
Direct answer
Treat accidental PII (personally identifiable information) in logs as a pipeline problem with three layers: prevent it at the source, filter it on the way out, and detect what still gets through. Keep debuggability by logging stable pseudonymous identifiers and structured fields, so engineers can still correlate events without seeing emails or tokens. Secrets such as tokens and passwords are never logged in any form, because pseudonymizing a credential does not make it safe.
Layer 1: stop it at the source
- Use structured logging with an allow-list of fields (a fixed list of field names that may be logged; anything else is dropped), so only named fields reach the log line, instead of dumping whole request objects.
- Wrap sensitive types (a
SecretorEmailclass) whose string form is masked, so an accidentallog(user)prints a placeholder. - Provide one shared logging library that engineers use, with safe defaults, and a lint or code-review rule against raw logging of request bodies and headers.
- Turn off verbose HTTP client and framework logging that prints headers by default in production.
Layer 2: filter before storage
Put a redaction step in the logging library or the log collector (a log collector is a background program that gathers log lines from services and ships them to storage). Redact secrets entirely; replace identifiers with a keyed pseudonym so the same user maps to the same value. A keyed hash (HMAC, a hash combined with a secret key) is better than a plain hash, because plain hashes of emails can be reversed by guessing: an attacker hashes a list of likely emails and compares. Without the secret key they cannot compute the same values. (A salt is a random value stored beside each hash so identical inputs differ; here we want the same email to give the same pseudonym, so one secret key is used for every value, which some call a pepper.) The key sits in a secrets manager and is rotated by policy.
import logging, re, hmac, hashlib, sys
SECRET_KEY = b"demo-key-held-in-a-secrets-manager"
EMAIL = re.compile(r"[\w.+-]+@[\w-]+\.[\w.]+")
BEARER = re.compile(r"(?i)bearer\s+[A-Za-z0-9._~+/=-]+")
def pseudonym(value: str) -> str:
return "u_" + hmac.new(SECRET_KEY, value.lower().encode(), hashlib.sha256).hexdigest()[:10]
class Email(str):
def __repr__(self): return "Email([masked])"
def __str__(self): return "[masked-email]"
def __format__(self, spec): return "[masked-email]"
class RedactFilter(logging.Filter):
def filter(self, record):
msg = record.getMessage()
msg = BEARER.sub("Bearer [REDACTED]", msg)
msg = EMAIL.sub(lambda m: pseudonym(m.group(0)), msg)
record.msg, record.args = msg, ()
return True
handler = logging.StreamHandler(sys.stdout)
handler.addFilter(RedactFilter())
log = logging.getLogger("app")
log.addHandler(handler)
log.setLevel(logging.INFO)
log.info("login failed for ana@example.com, header=Bearer abc123.def456")
log.info("login failed for ANA@example.com again")
log.info("password reset sent to bob@example.org")
u = Email("carol@example.com")
print("raw object logged: %s" % u)
print(f"f-string: {u}")
Output:
login failed for u_25f09a190b, header=Bearer [REDACTED]
login failed for u_25f09a190b again
password reset sent to u_da00333422
raw object logged: [masked-email]
f-string: [masked-email]
The Email class at the end of the code is the layer 1 wrapper: its string form is masked, so an accidental log of the object prints a placeholder in both %s and f-string formatting. The two lines about ana@example.com produce the same pseudonym (case-insensitive), so an engineer can still follow one user's failures. Pattern-based redaction is a safety net only: regexes miss formats they were not written for, which is why layer 3 exists.
Layer 3: catch what slips through
- Run a scanner over stored logs (and in CI over test logs) for email, token and ID patterns and alert on hits.
- Seed canary values (fake data planted on purpose, such as a made-up email in a test account, that should never appear in production logs) and alert if one ever appears there, because that means redaction failed.
- Treat a hit as a defect with an owner: fix the call site, then purge the affected log range.
Keeping logs useful for incidents and audits
| Need | Design |
|---|---|
| Correlate a user's actions | Keyed pseudonymous user ID and a request or trace ID (a unique ID passed through every service that handles one request, so their lines can be joined) on every line. |
| Investigator needs the real identity | A controlled, audited lookup from pseudonym to person, available to a small group, not a free-text search of raw logs. |
| Regulatory or audit logging | Log what happened (actor, action, object ID, time, outcome), not the content of the data; retain on a defined schedule. |
| Cost and volume | Sample verbose debug logs (for example keep a fraction of successful requests) but keep all errors and security events. |
Trade-offs
Redaction costs some CPU and can hide a detail you needed; the keyed lookup answers most of those cases. Deterministic pseudonyms make cross-event tracing possible but also allow linking a person's activity over time, so access to the key and to the lookup stays tightly limited.
Unlock Full Question Bank
Get access to all 18 Privacy by Design and Default interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.