Scrivio Interview library
LeadershipAdvanced7 min read · updated 12 November 2026

Under GDPR and PCI DSS, your company must show that personal and card data do not leak into logs across 200 services. Design the controls, ownership and evidence you would present to auditors.

I would present four things: a policy that classifies data and says which classes may appear in logs, technical controls that enforce it (a shared logging starter with masking, safe value types, review and static-analysis rules, and redaction in the pipeline), detection through scheduled scans of the log store for card numbers with a Luhn check, emails and tokens, and access and retention controls on the log indexes. The evidence is the documented controls, scan results over time, incident records with remediation times, and a named owner for every service who is accountable for its findings.

Why this question is asked

Auditors do not accept 'our developers are careful'. Under GDPR and PCI DSS, the company must be able to show, with evidence, that personal and card data are handled according to rules, and logs are one of the places where those rules are most often broken without anyone noticing. With 200 services, a manual review is impossible, so the answer has to be a system. Interviewers ask this leadership question to see whether we can design controls, assign ownership and produce evidence, rather than describe one masking library. In this answer, we will set the policy, build preventive controls, add detection, handle access and retention, assign ownership, and see what the evidence pack looks like.

1Start With a Policy Based on Data Classes

Everything else depends on a clear rule about what may be logged. I would define a small number of data classes with the privacy and security teams and state, for each one, whether it may appear in logs. Identifiers such as customer ids and order ids are allowed, because they are needed for debugging and reveal little on their own. Card numbers, card security codes, passwords, tokens and keys are never allowed. Other personal data, such as names, emails and addresses, is allowed only with a documented reason and an approved retention.

For PCI DSS, the important points are that full card numbers must be protected wherever they are stored, logs included, and that sensitive authentication data such as security codes must not be kept after authorisation; check the current version of the standard with the security team for the exact requirements. For GDPR, logs containing personal data are processing like any other, so purpose, minimisation and retention apply.

Data classes and logging rules
ClassExamplesIn logs?
Identifierscustomer id, order id, trace idyes
Contact and profile dataname, email, phone, addressonly with documented reason
Card datacard number (PAN), expirynever; last four digits allowed
Sensitive authentication dataCVV, PINnever
Secretspasswords, tokens, API keysnever

2Preventive Controls in the Platform

With 200 services, controls must live in the platform rather than in each team's discipline. The shared logging starter ships a masking configuration for known patterns, the production defaults that keep risky loggers such as HTTP wire logs off, and an allow list of MDC keys. The shared domain library provides safe value types, such as CardNumber and EmailAddress, whose toString() never reveals the value.

In code review and static analysis, we ban patterns that are known to leak: logging whole request or entity objects, records containing sensitive fields without an explicit toString(), and string concatenation of request bodies into exception messages. A rule set in a static analysis tool, or a small ArchUnit test in each service, can enforce some of this automatically. Finally, the log pipeline applies the same redaction patterns to everything it receives, including applications that are not on the starter yet.

3Detection: Scanning the Log Store

Prevention will never be perfect, so detection proves whether it works. A scheduled job scans each day's logs for sensitive patterns and creates findings for the owning team. For card numbers, a plain digit pattern produces many false positives, such as order numbers and timestamps, so the scanner also runs the Luhn check, the checksum that every valid card number passes.

Java
static boolean luhn(String digits) {
int sum = 0;
boolean doubleIt = false;
for (int i = digits.length() - 1; i >= 0; i--) {
int d = digits.charAt(i) - '0';
if (doubleIt) { d *= 2; if (d > 9) d -= 9; }
sum += d;
doubleIt = !doubleIt;
}
return sum % 10 == 0;
}
luhn("4111111111111111"); // true: a test Visa number, flag it
luhn("4111111111111112"); // false: probably an order number, ignore
// scanner: 13 to 19 digit runs -> Luhn check -> finding with service, index, count

The same scanner looks for email addresses, Bearer tokens, private key headers and other secret formats. Each finding names the service, from the service.name field in the structured logs, and goes to that service's owner with a remediation deadline, for example 7 days for card data and secrets and 30 days for other personal data.

4Access and Retention

Logs that contain any personal data need the same care as other systems with personal data. Access to log indexes should be role-based: engineers see their own services' operational logs, a smaller group sees everything, and access is itself logged. Retention for operational logs should be short, for example 14 to 30 days, because short retention limits the damage of anything the controls miss. Deletion should be a tested process, because both GDPR erasure obligations and incident clean-ups depend on being able to remove specific events, including from backups and secondary copies.

5Ownership and the Evidence Pack

Every service must have a named owning team in the service catalogue, and that team is accountable for its findings. Without an owner, findings sit in a queue forever. A platform team owns the starter, the pipeline rules and the scanner; security owns the policy; each service team owns its code and its findings.

The evidence for auditors then comes naturally from the system. It includes the policy document and data classes, the description of each control with its configuration, the percentage of services on the current starter, scan results over time showing findings per month and their trend, the list of findings with time to remediate, records of incidents and their post-mortems, access reviews of the log indexes, and the results of deletion tests. A trend that shows findings falling from, say, 140 in the first month to under 10 per month after two quarters is far more convincing than any statement.

Step throughControl system for sensitive data in logs
  1. Policydata classes and logging rules, owned by security
  2. Preventionstarter masking, safe types, review and static rules, pipeline redaction
  3. Detectiondaily scans with Luhn check, findings to owners
  4. Access and retentionrole-based indexes, short retention, tested deletion
  5. Evidencecontrols, scan trends, remediation times, incidents

5 layers, from the top down. Step through them one at a time.

6Follow-up questions

How do you handle logs kept by third-party SaaS log vendors?

The vendor is a processor of whatever personal data our logs contain, so it needs a data processing agreement, an assessment of its security and certifications, and clarity about where data is stored and for how long. Our controls should mask or drop sensitive data before it leaves our network, in the pipeline, so the vendor receives as little as possible. Retention and deletion at the vendor must match our policy, and the vendor's access to our data, for example by its support staff, should be covered by the contract and reviewed.

What do you do when the scanner finds card numbers in a service's logs?

Treat it as an incident sized by the finding: identify the source code or configuration, fix it, purge or redact the stored events and copies, and record the timeline. Security decides whether it needs to be reported further. The finding and its remediation time become part of the evidence, which is fine; auditors expect findings, and they look at whether the company detects and fixes them.

How do you get 200 teams to adopt the starter?

Make it the easiest path: it comes with the platform bill of materials, it brings useful defaults such as JSON logging and trace ids, and upgrading is a dependency bump. Track adoption per service on a dashboard, and for the remaining services rely on pipeline redaction while their owners migrate.

7Conclusion

In this answer, we designed controls for sensitive data in logs across 200 services. A policy based on data classes says what may be logged; preventive controls in the shared starter, safe value types, review and static rules and pipeline redaction enforce it; daily scans with a Luhn check, email and token patterns detect what slips through and route findings to owners; role-based access, short retention and tested deletion limit the damage; and the evidence pack shows the controls, scan trends, remediation times and incidents, with a named owner accountable for every service.

What to say in the interviewAbout 90 seconds aloud

Open with

I'd build it in layers and make sure each layer produces evidence. It starts with a policy, written with security and privacy, that classifies data and says what may be logged: identifiers yes, card numbers, CVV, passwords and tokens never, other personal data only with a documented reason and retention.

Then, if they want more

Then preventive controls in the platform, because 200 teams can't each be expected to get it right: a shared logging starter with masking for known patterns and risky loggers switched off, safe value types like a CardNumber whose toString shows only the last four digits, banned patterns in reviews and static analysis such as logging whole entities, and the same redaction in the log pipeline for everything.

Then detection: a daily scan of the log store for card numbers with a Luhn check to cut false positives, plus emails and tokens, with each finding routed to the owning service with a deadline. Then access and retention: role-based access to log indexes, short retention for operational logs, and deletion processes we've actually tested, including vendor copies.

Every service has a named owner accountable for its findings. For auditors, the evidence is the policy and control descriptions, adoption of the starter, scan results over time, remediation times, incidents and post-mortems, and access reviews. A falling trend of findings is the strongest evidence that the controls work.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Under GDPR and PCI DSS, your company must show that personal and card data do not leak...": https://scrivio-interview-library.netlify.app/java/java-logging/0d4bd24587/