Plan what my service should log

Plans which events, fields and levels a service should log so problems can be traced, without logging personal data or secrets.

Task: Plan what my service should log so that I can trace a failed request from start to finish. Context: The service is [service description] written in [language and framework]. It handles about [requests per day] requests per day and talks to [other systems]. Logs go to [log tool or destination]. The hardest problem to debug today is [recent debugging pain]. Rules: - Choose at most ten events to log, each with a level, the fields to include and one sentence on why it earns its cost. - Include a request or correlation identifier on every event so one request can be followed across services. - List what must never be logged, such as passwords, tokens, full card numbers and personal data, and say how to mask what you cannot avoid. - If privacy law applies to my logs, say that I should check the rules with a qualified professional. Result: A table with the columns event, level, fields and reason. Close with one sentence on how long to keep logs until I decide the retention period myself.

Updated