A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/how-to-configure-server-logs below:

Download PostgreSQL and upgrade logs - Azure Database for PostgreSQL

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.

Steps to enable the capture of PostgreSQL and 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.

  3. Mark the Capture logs for download checkbox.

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

  5. Select the Save button.

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

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

You can enable the capture of PostgreSQL server logs and major version upgrade logs via the az postgres flexible-server parameter set command.

To enable the capture of the logs for download, use this command:

az postgres flexible-server parameter set \
  --resource-group <resource_group> \
  --server-name <server> \
  --name logfiles.download_enable \
  --value on

To adjust the retention period for the logs that are captured for download, use this command:

az postgres flexible-server parameter set \
  --resource-group <resource_group> \
  --server-name <server> \
  --name logfiles.retention_days \
  --value <retention_period_in_days>

Allowed values for server parameter logfiles.retention_days can be between 1 and 7 days. If you try to set it to a different value, you get this error:

Code: ServerParameterToCMSUnAllowedParameterValue
Message: The value: [<value>] of Server Parameter: [logfiles.retention_days] is invalid, the allowed values are: [1-7]

Note

Steps to disable the capture of PostgreSQL and 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.

  3. Clear the Capture logs for download checkbox.

  4. Select the Save button.

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

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

You can disable the capture of PostgreSQL server logs and major version upgrade logs via the az postgres flexible-server parameter set command.

To disable the capture of the logs for download, use this command:

az postgres flexible-server parameter \
  --resource-group <resource_group> \
  --server-name <server> \
  --name logfiles.download_enable \
  --value off
Steps to 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.

  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 files with names that contain, 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:

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

You can list the captured PostgreSQL server logs and major version upgrade logs via the az postgres flexible-server server-logs list command.

To list all captured logs available for download, which were updated in the last 72 hours (default value), use this command:

az postgres flexible-server server-logs list \
  --resource-group <resource_group> \
  --server-name <server>

To list all captured logs available for download, which were updated in the last 10 hours, use this command:

az postgres flexible-server server-logs list \
  --resource-group <resource_group> \
  --server-name <server> \
  --file-last-written 10

To list all captured logs available for download, whose size is under 30 KiB, use this command:

az postgres flexible-server server-logs list \
  --resource-group <resource_group> \
  --server-name <server> \
  --max-file-size 30

To list all captured logs available for download, whose name contains 01_07, use this command:

az postgres flexible-server server-logs list \
  --resource-group <resource_group> \
  --server-name <server> \
  --filename-contains 01_07
Steps to download captured logs

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.

  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 files with names that contain, 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.

  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.

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

You can download the captured PostgreSQL server logs and major version upgrade logs via the az postgres flexible-server server-logs download command.

To download one specific log, use this command:

az postgres flexible-server server-logs download \
  --resource-group <resource_group> \
  --server-name <server> \
  --name <log_name>

To download one specific log, use this command:

az postgres flexible-server server-logs download \
  --resource-group <resource_group> \
  --server-name <server> \
  --name <log1_name log2_name ...logn_name>

Note


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4