Skip to content

Latest commit

 

History

History
57 lines (40 loc) · 2.66 KB

sample-server-logs.md

File metadata and controls

57 lines (40 loc) · 2.66 KB
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]

Sample script

[!INCLUDE cli-launch-cloud-shell-sign-in.md]

Run the script

:::code language="azurecli" source="~/azure_cli_scripts/postgresql/server-logs/server-logs.sh" id="FullScript":::

Clean up deployment

[!INCLUDE cli-clean-up-resources.md]

az group delete --name $resourceGroup

Sample reference

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.

Next steps