Description
With log_connections set to on as shown, Flexible Server logs connection attempts and successful authentication and authorization. These records show which account connected and when.
Potential impact
Without connection records, it is harder to trace an unexpected rise in connections to an account or application.
Remediation
Choose a value your server version supports for the events you need and check the effective setting. Open a new authorized connection and find its account and time at the log destination. Set log access and retention, and manage database access controls and any required query audit separately.
Examples
The first resource targets retired Single Server. The second uses the server_id of an existing Flexible Server that accepts on for log_connections.
Before
resource "azurerm_postgresql_configuration" "example" {
name = "log_connections"
resource_group_name = data.azurerm_resource_group.example.name
server_name = azurerm_postgresql_server.example.name
value = "OFF"
}
After
resource "azurerm_postgresql_flexible_server_configuration" "example" {
name = "log_connections"
server_id = azurerm_postgresql_flexible_server.example.id
value = "on"
}