A vendor needs application logs, but they contain emails and card numbers. Mask them first.
IntermediateScenarioScenarios: text processing and scheduling decisions
Answer
Situation read → Redact with regexes, verify nothing remains, and share only what is needed.
What I'd do →
sed -E \
-e 's/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/<email>/g' \
-e 's/\b[0-9]{4}[ -]?[0-9]{4}[ -]?[0-9]{4}[ -]?[0-9]{1,4}\b/<card>/g' \
-e 's/(Authorization: Bearer )[A-Za-z0-9._-]+/\1<token>/g' \
app.log > app.redacted.log
grep -cE '[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}' app.redacted.log # expect 0
- Verify with a second pass that searches for the patterns again.
- Reduce scope first (time window, relevant request IDs) so less data leaves.
Why → Logs are a frequent source of PII and secrets leaks; regex redaction plus verification is the minimum.
Interview tip → Mention fixing the root cause: applications should not log card numbers at all (PCI DSS).
More on Scenarios: text processing and scheduling decisions
Users report errors in the last hour. From the Nginx access log, find which endpoints produce the most 5xx responses.BeginnerA MySQL slow log is 3 GB. You need the 10 slowest query patterns. What do you do?IntermediateTwo servers that should be identical behave differently. Compare their installed packages.BeginnerFind which pods were OOMKilled in a namespace, with their container names and restart counts.IntermediateProduce a CSV of running EC2 instances that are missing an `Owner` tag.IntermediateYou have access logs from five web servers and need one timeline sorted by time. How?Intermediate