Logs Required
Keep logs for a fixed time
Keep logs only as long as you need them, delete them on a schedule, and say how long in the privacy policy.
How to do it
Set rotation and deletion in the log store, such as logrotate, journald MaxRetentionSec or the retention setting of a hosted service. Weeks are usually enough for debugging. Security logs may need longer, so keep them apart with their own limit. Email delivery logs follow the same idea, as in lean email logs.
Example
/var/log/shop/*.log {
daily
rotate 14
compress
missingok
}
How to check
The oldest file or entry in each log store is younger than its stated limit, and the privacy policy names the same limit.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers operations playbook: https://agentwranglers.se/playbook/operations/logs/log-retention.