Review Alicloud RDS SQL record retention

Retain SQL records for the period needed for investigation.

Description

Disabled RDS SQL collection or a short retention period can leave required query history unavailable. Choose retention according to troubleshooting and audit needs.

Potential impact

Relevant SQL records may already be deleted when an issue is discovered, making investigation harder.

Remediation

Set sql_collector_status = "Enabled" where needed and select a supported retention period. If at least 180 days are required, choose a supported value such as 180 or 365 and manage access to the records and their cost.

Examples

The examples extend collected records from 30 to 180 days on an existing MySQL instance. This controls log retention, not database backup retention.

Before

hcl
resource "alicloud_db_instance" "default" {
  engine                   = "MySQL"
  engine_version           = "5.6"
  instance_type        = "rds.mysql.t1.small"
  instance_storage      = "10"
  sql_collector_status     = "Enabled"
  sql_collector_config_value = 30
}

After

hcl
resource "alicloud_db_instance" "default" {
  engine                     = "MySQL"
  engine_version             = "5.6"
  instance_type          = "rds.mysql.t1.small"
  instance_storage        = "10"
  sql_collector_status       = "Enabled"
  sql_collector_config_value = 180
}

References