CloudWatch Log Retention Policy

Purpose#

The purpose of this policy document is to outline the retention length strategy for AWS CloudWatch logs collected.

As of August 2022, logs are retained indefinitely. This results in:

Scope#

This policy applies for all past, current and future development projects that utilise the AWS service CloudWatch to collect logs. The retention period will vary depending on the deployment environment.

Policy statement#

Development#

A development environment is usually ever changing and unstable with ongoing feature development and changes. Any data changes occurring within the environment are for development purposes only - no live data is generated within this environment. Logs are required for the duration of a feature development - if the ongoing feature development is longer than the agreed retention period (detailed below), the logs can be re-generated by reproducing the issue being investigated.

All logs collected in a development environment must be retained for a maximum of 30 days.

Staging#

Staging environments are used for quality assurance purposes, including user acceptance testing. Any data changes occurring within the environment are for testing purposes only - no live data is generated within this environment. For this reason, logs should not be retained for a prolonged period of time.

All logs collected in a staging environment must be retained for a maximum of 3 weeks.

Production#

A production environment is a live environment and retaining logs for a longer period of time is required in order to enable investigation for bugs and issues. Depending on priorities, in line with SLA policies, reported issues could not be looked into immediately. This requires logs to be available for a longer period of time to enable engineers to perform an investigation at a later stage.

All logs collected in a production environment must be retained for a minimum of 6 months, as per Hackney’s logs management policy, and a maximum of 8 months.