Scrivio Interview library
LeadershipPrincipal6 min read · updated 13 November 2026

Logs are the largest part of a company's observability bill. Security wants every log kept for a year for investigations, privacy wants personal data minimised and deletable on request, and engineering wants fast search over 30 days.

As the senior technical leader, how do you set a logging policy that balances cost, security, privacy and engineering needs?

I would classify logs by purpose: operational debugging logs with short retention and fast search, security and audit events with long, cheaper, access-restricted retention, and business events that belong in event streams or databases rather than logs. Personal data is redacted or tokenised at the source and in the pipeline, secrets and full payloads are never logged, and deletion is possible through short retention or per-subject encryption keys. Retention is tiered per class with costs shown to owning teams and defaults raised only with a stated reason, logs follow a shared structured schema, and the policy is agreed with security, privacy and legal and reviewed every quarter.

Why this question is asked

Logging policy is where three reasonable groups collide. Security wants everything for a year because investigations look backwards, privacy wants as little personal data as possible and deletable on request, and engineering wants fast search over a month, while the bill grows with all of it. Each request is sensible alone and impossible together if all logs are treated the same. Interviewers ask this to see whether a senior leader can resolve such a conflict with structure rather than compromise. In this answer, we will classify logs by purpose, handle personal data, set tiered retention with visible costs, standardise structure, and agree and review the policy.

1Classify Logs by Purpose

The conflict dissolves once we stop saying 'logs' as if they were one thing. Different logs serve different purposes, and each purpose has its own natural retention, search speed and access rules.

Log classes and their rules
ClassRetention and searchAccess
Operational debugging30 days, fast search 7 to 30 daysengineering teams
Security and audit events1 year or more, cheap, slower searchsecurity team, restricted
Business eventsnot logs: event streams or databasesowning product team
Debug level3 days or off in productionowning team

Notice how this answers each group. Security gets a year, but only of the events that matter for investigations, such as logins, permission changes and admin actions, which are a small fraction of total volume and can live in cheap storage. Engineering gets fast search over 30 days of operational logs. And business events, such as 'order placed', move out of logs entirely, because they deserve a schema, a guaranteed delivery and an owner, which a log line does not have.

2Personal Data: Minimise, Redact, Make Deletable

The best personal data in logs is none. The policy forbids logging secrets, such as passwords, tokens and keys, and full request or response payloads, which are where personal data leaks in. Logging libraries are configured with redaction for known fields, such as emails, phone numbers and card numbers, and the pipeline applies a second redaction pass, because some data always slips through code review.

Where an identifier is needed for debugging, we tokenise it: replace the user's email with a stable token that can be resolved only through a separate, access-controlled service. Engineers can still follow one user's requests through the logs without seeing who the user is.

3Making Deletion Possible

Privacy law gives people the right to have their data deleted, and deleting individual lines from a year of compressed log chunks is impractical. There are two workable answers. For operational logs, short retention is the deletion mechanism: 30 days after the request, the data is gone everywhere, and the policy says so.

For long-retained logs that must contain personal data, we use per-subject encryption keys, sometimes called crypto-shredding. Each person's identifiers are encrypted with a key specific to that person, stored in a key service. To delete the person, we delete the key; the encrypted values in a year of archives become unreadable, without rewriting a single file. Legal should confirm that this satisfies the deletion requirement in each jurisdiction we operate in.

4Tiered Retention With Visible Costs

Each class gets default retention and a storage tier, and each team sees the cost of its logs every month. Defaults are deliberately lean, and a team can raise them only with a stated reason, recorded and reviewed, such as a contractual audit requirement. Without the reason, the default stands.

This changes behaviour more than any rule. When a team sees that its debug logging costs more than its database, and that keeping it for 90 days instead of 7 doubles that, it decides for itself what it really needs. Cost becomes part of the engineering conversation rather than a surprise for finance.

Step throughAdding a new kind of log
  1. Is it a business event?orders, payments, state changes
    YesPublish to an event stream insteadNoContinue
  2. Is it a security or audit event?auth, permissions, admin actions
    YesAudit class: long, restrictedNoOperational class: 30 days
  3. Does it contain personal data?check the schema fields
    YesRedact or tokenise, register the fieldNoShip it
  4. Need longer retention than default?state the reason
    YesRequest with reason, recordedNoUse the default

4 steps in order. Play them, or step through them one at a time.

5A Shared Structured Schema

Volume is not the same as value. A free-text line like 'error processing request' costs as much to store as a structured one but answers no questions. So we standardise structured logs with a shared schema: timestamp, service, environment, level, trace id, event name and typed fields, plus consistent meanings for levels, so ERROR means something needs attention and is not used for expected validation failures.

With trace ids in every line, engineers can jump from a metric to a trace to the exact log lines, and they need far fewer log lines to understand a problem. Less volume then carries more value, which is the real goal behind the cost discussion.

6Agreeing and Reviewing the Policy

A policy written by engineering alone will be overruled by the first audit. So security, privacy and legal sign it together with engineering: security confirms which events and retention its investigations need, privacy confirms redaction and deletion, and legal confirms regulatory retention requirements. Each group gives up something, but each gets a clear, enforceable rule.

Then we review every quarter: volumes and costs per class and team, exceptions granted, redaction failures found in samples, and any incident or investigation where the logs were not enough. The policy is a living document, and the quarterly review is what keeps it honest.

7Follow-up questions

How do we enforce the policy in hundreds of services?

Mostly through defaults rather than review: a shared logging library with the schema and redaction built in, pipeline rules that classify and route by event fields, retention set by the platform rather than by each team, and automated scans that sample logs for personal data patterns and secrets and alert the owner.

What if security needs data from an operational log after 30 days?

That is a signal that the event should be in the audit class. We review the investigation, add the event type to the audit class, and from then on it is kept long-term. Keeping all operational logs for a year just in case is the expensive answer the classification avoids.

Do per-subject encryption keys make search harder?

Encrypted fields cannot be searched by value, which is why we encrypt only identifiers and personal fields, not the whole line. Searching by a person requires resolving their token or key first, through a controlled service, which is also a sensible access control.

8Conclusion

In this answer, we resolved the conflict between security, privacy, engineering and cost by classifying logs by purpose: operational logs with short retention and fast search, security and audit events kept long, cheaply and with restricted access, and business events moved to event streams. We minimised and redacted personal data, made deletion possible through short retention or per-subject encryption keys, set tiered retention with costs shown to teams and exceptions only with a reason, standardised structured logs, and agreed the policy with security, privacy and legal with a quarterly review.

What to say in the interviewAbout 80 seconds aloud

Open with

I would start by not treating logs as one thing. I classify them by purpose: operational debugging logs, which get fast search but short retention, around thirty days; security and audit events like logins, permission changes and admin actions, which are a small fraction of the volume and can be kept a year or more in cheaper, access-restricted storage; and business events, which should not be logs at all but events in a stream or a database with an owner.

Then, if they want more

For privacy, secrets and full payloads are never logged, personal data is redacted or tokenised in the logging library and again in the pipeline, and deletion is possible because operational logs expire quickly and long-retained personal fields are encrypted with per-subject keys, so deleting the key makes them unreadable.

Retention is tiered per class with sensible defaults, and teams can raise them only with a stated reason; every team sees the monthly cost of its logs, which changes behaviour faster than rules. I would standardise structured logs with a shared schema, trace ids and consistent levels, so less volume carries more value.

The policy is agreed and signed by security, privacy and legal together with engineering, and we review volumes, costs, exceptions and redaction findings every quarter.

About this answer

Last updated
13 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 "As the senior technical leader, how do you set a logging policy that balances cost...": https://scrivio-interview-library.netlify.app/architecture/system-design-problems/96b9d75811/