Description
On RDS PostgreSQL, log_disconnections records when a session ends and how long it lasted.
Potential impact
Without the end record, a connection log alone may leave the length of a session unclear.
Remediation
Set log_disconnections to ON where supported. Close a test session and find its end record and duration. Use log_connections to correlate the start, and set log access and retention. For other engines, check the equivalent session audit settings.
Examples
Use a supported PostgreSQL version and instance configuration 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
parameters {
name = "log_disconnections"
value = "OFF"
}
}
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_disconnections"
value = "ON"
}
}