Small PostgreSQL DB Server Log Retention Period

  • Query id: 261a83f8-dd72-4e8c-b5e1-ebf06e8fe606
  • Query name: Small PostgreSQL DB Server Log Retention Period
  • Platform: Terraform
  • Severity: Medium
  • Category: Observability
  • URL: Github

Description

Check if PostgreSQL Database Server retains logs for less than 3 Days
Documentation

Code samples

Code samples with security vulnerabilities

Positive test num. 1 - tf file
resource "azurerm_postgresql_configuration" "positive1" {
  name                = "log_retention_days"
  resource_group_name = azurerm_resource_group.example.name
  server_name         = azurerm_postgresql_server.example.name
  value               = 2
}

Code samples without security vulnerabilities

Negative test num. 1 - tf file
resource "azurerm_postgresql_configuration" "negative1" {
  name                = "log_retention_days"
  resource_group_name = azurerm_resource_group.example.name
  server_name         = azurerm_postgresql_server.example.name
  value               = 5
}