編集

次の方法で共有


Configure capture of PostgreSQL server logs and major version upgrade logs

APPLIES TO: Azure Database for PostgreSQL - Flexible Server

You can use PostgreSQL server logs to diagnose specific issues experienced in an Azure Database for PostgreSQL flexible server, and to gain detailed insights about the activities that run on your servers. You can use major version upgrade logs to troubleshoot errors that might occur during an attempt to upgrade your server to a higher major version of PostgreSQL.

By default, capturing server logs for download in an Azure Database for PostgreSQL flexible server is disabled. However, after you enable the feature, your Azure Database for PostgreSQL flexible server starts capturing the server logs to files, which you can download for detailed inspection. You can use Azure portal or Azure CLI commands to list and download these files that can assist you with any troubleshooting efforts.

This article explains how to enable and disable the feature. It also describes how you can list all available server logs, and how can you download any of them.

Enable the capture of PostgreSQL server logs and major version upgrade logs for download

Using the Azure portal:

  1. Select your Azure Database for PostgreSQL flexible server.

  2. In the resource menu, under the Monitoring section, select Server logs.

    Screenshot showing the Server logs page.

  3. Under Download server logs, mark the Enable checkbox.

    Screenshot showing how to configure the server for PostgreSQL server logs and major version upgrade logs to be captured. You can download captured log files  for inspection.

  4. By default, log files are retained for three days, but you can adjust the retention period from 1 to 7 days. Use the Retention period (in days) slicer to adjust to your desired configuration.

    Screenshot showing how to adjust the retention period for PostgreSQL server logs and major version upgrade logs captured.

  5. Select the Save button.

    Screenshot showing how to save configuration changes made to Server logs page.

  6. A notification informs you that the service is configuring the capture of logs for download.

    Screenshot showing the notification informing that configuration changes are being applied.

  7. Once the operation ends, a notification informs you that the service completed the configuration of the capture of logs for download.

    Screenshot showing the notification informing that configuration changes were successfully applied.

Note

  • A few minutes after enabling the capture of server logs for download, the first log will be available for download.

  • Initially, and for approximately one hour, server logs occupy data disk space. Then, they're moved to backup storage and kept there for the configured retention period.

Disable the capture of PostgreSQL server logs and major version upgrade logs for download

Using the Azure portal:

  1. Select your Azure Database for PostgreSQL flexible server.

  2. In the resource menu, under the Monitoring section, select Server logs.

    Screenshot showing the Server logs page.

  3. Under Download server logs, clear the Enable checkbox.

    Screenshot showing how to configure the server so that PostgreSQL server logs and major version upgrade logs stop being captured for download.

  4. Select the Save button.

    Screenshot showing how to save configuration changes made to Server logs page.

  5. A notification informs you that the service is configuring the capture of logs for download.

    Screenshot showing the notification informing that configuration changes are being applied.

  6. Once the operation ends, a notification informs you that the service completed the configuration of the capture of logs for download.

    Screenshot showing the notification informing that configuration changes were successfully applied.

List captured logs available for download

Using the Azure portal:

  1. Select your Azure Database for PostgreSQL flexible server.

  2. In the resource menu, under the Monitoring section, select Server logs.

    Screenshot showing the Server logs page with some logs captured.

  3. A table shows all captured log files which aren't deleted yet. Files which were captured at some point, but were deleted because they exceeded the configured retention period, aren't visible or accessible anymore. Using the Search for a log file, Log time range, and Log Type boxes, you can define filtering conditions to reduce the logs shown. By selecting a column header, you can sort the list of visible log files, in ascending or descending order, by the value of the attribute represented by the selected header. Under each available column, you can see the different attributes of each file:

    • Name: Name of the log file. The service assigns each log file a name with this pattern postgresql_yyyy_mm_dd_hh_00_00.log.
    • Last update time: Timestamp of the last time each log file was uploaded. Log files are uploaded, approximately, every 10 minutes.
    • Size: Size in bytes occupied by the log file.
    • Log Type: Server Log indicates the file corresponds to a PostgreSQL server log. Upgrade Log indicates the file corresponds to a major version upgrade log.

    Screenshot showing the Server logs page with some logs captured and highlighting column headers.

  4. Content of the table isn't automatically updated. To see the most recent information, you can select Refresh.

    Screenshot showing the Server logs page and highlighting the Refresh button to update the contents of the page.

Download captured logs available for download

Using the Azure portal:

  1. Select your Azure Database for PostgreSQL flexible server.

  2. In the resource menu, under the Monitoring section, select Server logs.

    Screenshot showing the Server logs page with some logs captured.

  3. A table shows all captured log files which aren't deleted yet. Files which were captured at some point, but were deleted because they exceeded the configured retention period, aren't visible or accessible anymore. Using the Search for a log file, Log time range, and Log Type boxes, you can define filtering conditions to reduce the logs shown. By selecting a column header, you can sort the list of visible log files, in ascending or descending order, by the value of the attribute represented by the selected header. Identify the log that you want to download and, under the Actions column, select Download.

    Screenshot showing the Server logs page with some logs captured and highlighting how to download one of them.

  4. If you want to download multiple log files at one time, select all the files that you want to download, and select Download in the toolbar.

    Screenshot showing the Server logs page with some logs captured and highlighting how to download multiple files.

  5. Content of the table isn't automatically updated. To see the most recent information, you can select Refresh.

    Screenshot showing the Server logs page and highlighting the Refresh button to update the contents of the page.

Share your suggestions and bugs with the Azure Database for PostgreSQL product team.