Skip to main content

Triage and Remediation

Remediation

Using Console

To remediate the “LOG_DURATION” parameter misconfiguration for PostgreSQL Servers in Azure, you can follow the below steps:
  1. Log in to the Azure portal (https://portal.azure.com/).
  2. Navigate to the PostgreSQL server for which you want to enable the “LOG_DURATION” parameter.
  3. Click on the “Configuration” tab from the left-hand side menu.
  4. Scroll down to the “Parameters” section and search for the “log_duration” parameter.
  5. If the “log_duration” parameter is not present, click on the ”+ Add parameter” button and add the parameter.
  6. Set the value of the “log_duration” parameter to “on” to enable it.
  7. Click on the “Save” button to save the changes.
After following the above steps, the “LOG_DURATION” parameter will be enabled for the PostgreSQL server in Azure.

To remediate the misconfiguration of enabling the “LOG_DURATION” parameter for PostgreSQL servers in AZURE using AZURE CLI, you can follow the below steps:
  1. Open the AZURE CLI and log in to your AZURE account.
  2. Run the below command to get the list of all the PostgreSQL servers in your subscription:
  3. Select the PostgreSQL server for which you want to enable the “LOG_DURATION” parameter and note down its resource group name and server name.
  4. Run the below command to enable the “LOG_DURATION” parameter for the selected PostgreSQL server:
    Replace <resource_group_name> and <server_name> with the actual values of the resource group name and server name noted down in step 3.
  5. Verify that the “LOG_DURATION” parameter is enabled for the PostgreSQL server by running the below command:
    If the output shows the value of “value” parameter as “on”, then the “LOG_DURATION” parameter is enabled for the PostgreSQL server.
By following the above steps, you can remediate the misconfiguration of enabling the “LOG_DURATION” parameter for PostgreSQL servers in AZURE using AZURE CLI.
To enable the “LOG_DURATION” parameter for PostgreSQL servers in Azure using python, you can follow the below steps:
  1. Import the necessary libraries:
  1. Set the credentials for authentication:
  1. Create a PostgreSQL management client object:
  1. Get the PostgreSQL server you want to enable the “LOG_DURATION” parameter for:
  1. Update the server configuration to enable the “LOG_DURATION” parameter:
  1. Verify that the configuration has been updated:
This should enable the “LOG_DURATION” parameter for the PostgreSQL server in Azure.
This change does not replace the PostgreSQL server; it updates a configuration setting in place (a short restart may occur depending on Azure behavior, but Terraform will not recreate the server).After updating your Terraform, terraform plan should show creation (or update) of azurerm_postgresql_configuration.log_duration with value changing from "off" (or unset) to "on" and no destroy/create for the azurerm_postgresql_server.