title | description | ms.author | author | ms.service | ms.devlang | ms.topic | ms.custom | ms.date |
---|---|---|---|---|---|---|---|---|
Azure CLI script - Download server logs |
This sample Azure CLI script shows how to enable and download the server logs of an Azure Database for PostgreSQL - Flexible Server instance. |
sunila |
sunilagarwal |
postgresql |
azurecli |
sample |
mvc, devx-track-azurecli |
01/26/2022 |
Enable and download server slow query logs of an Azure Database for PostgreSQL - Flexible Server instance using Azure CLI
[!INCLUDEapplies-to-postgres-single-flexible-server]
This sample CLI script enables and downloads the slow query logs of a single Azure Database for PostgreSQL flexible server instance.
[!INCLUDE quickstarts-free-trial-note]
[!INCLUDE azure-cli-prepare-your-environment.md]
[!INCLUDE cli-launch-cloud-shell-sign-in.md]
:::code language="azurecli" source="~/azure_cli_scripts/postgresql/server-logs/server-logs.sh" id="FullScript":::
[!INCLUDE cli-clean-up-resources.md]
az group delete --name $resourceGroup
This script uses the commands outlined in the following table:
Command | Notes |
---|---|
az group create | Creates a resource group in which all resources are stored. |
az postgres server create | Creates an Azure Database for PostgreSQL flexible server instance that hosts the databases. |
az postgres server configuration list | Lists the configuration values for a server. |
az postgres server configuration set | Updates the configuration of a server. |
az postgres server-logs list | Lists log files for a server. |
az postgres server-logs download | Downloads log files. |
az group delete | Deletes a resource group including all nested resources. |
- Read more information on the Azure CLI: Azure CLI documentation.
- Try additional scripts: Azure CLI samples for Azure Database for PostgreSQL - Flexible Server instance
- Configure and access server logs in the Azure portal