Review Alibaba Cloud RDS PostgreSQL connection logging

Configure connection logs to support investigation of database access attempts.

Description

On RDS PostgreSQL, use log_connections to record connection attempts and successful connections.

Potential impact

Missing connection history makes unusual account activity harder to investigate.

Remediation

Check the parameter values your PostgreSQL version supports. If it supports the value shown, set log_connections to ON in parameters. Open a new test connection and find its entry in the database logs. Restrict log access and set retention. Use the equivalent audit setting for other engines.

Examples

The first excerpt omits the parameter, so check its effective value. Supply a supported version, instance type, storage and network for your region.

Before

hcl
resource "alicloud_db_instance" "default" {
  engine           = "PostgreSQL"
  engine_version   = var.postgresql_version
  instance_type    = var.db_instance_type
  instance_storage = var.db_instance_storage
}

After

hcl
resource "alicloud_db_instance" "default" {
  engine           = "PostgreSQL"
  engine_version   = var.postgresql_version
  instance_type    = var.db_instance_type
  instance_storage = var.db_instance_storage

  parameters {
    name  = "log_connections"
    value = "ON"
  }
}

References