Can server logs be enabled for Postgres Flexible server using BICEP code?

Sai Praneeth Eranti 170 Reputation points
2024-09-13T12:40:41.67+00:00

Hello,

Is it possible to enable server logs for Postgres Flexible server via BICEP code or does it have to be done through the GUI? For example, we can turn on diagnostics using "Microsoft.Insights/diagnosticSettings@2021-05-01-preview".

User's image

Azure Database for PostgreSQL
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Oury Ba-MSFT 19,346 Reputation points Microsoft Employee
    2024-09-13T16:01:49.1033333+00:00

    @Sai Praneeth Eranti Thank you for reaching out.

    You can achieve the above using GUI or CLI or Bicep

    https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/how-to-server-logs-cli

    there are two parts here

    1. Configuring the logs for Log Analytics (LA)
      • One time setup
        • Can be done via Portal, CLI, Bicep
    2. Query the logs via KQL
      • Querying has to be done via any Kusto client (Azure portal, Kusto explorer, PowerShell etc.)

    Regards,

    Oury


  2. Sai Praneeth Eranti 170 Reputation points
    2024-09-21T02:35:10.4833333+00:00

    As per MS , There is no API code for BICEPS to enable server logs for an Azure PostgreSQL Flexible server. You can only achieve this using CLI or the portal functionality.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.