Enable, list and download server logs for Azure Database for MySQL - Flexible Server
APPLIES TO: Azure Database for MySQL - Flexible Server
You can use server logs to help monitor and troubleshoot an instance of Azure Database for MySQL - Flexible Server, and to gain detailed insights into the activities that have run on your servers. By default, the server logs feature in Azure Database for MySQL - Flexible Server is disabled. However, after you enable the feature, a flexible server starts capturing events of the selected log type and writes them to a file. You can then use the Azure portal or the Azure CLI to download the files to assist with your troubleshooting efforts. This article explains how to enable the server logs feature in Azure Database for MySQL - Flexible Server and download server log files. It also provides information about how to disable the feature.
In this tutorial, you’ll learn how to:
- Enable the server logs feature.
- Disable the server logs feature.
- Download server log files.
To complete this tutorial, you need an existing Azure Database for MySQL - Flexible Server. If you need to create a new server, see Create an Azure Database for MySQL - Flexible Server.
Enable Server logs
To enable the server logs feature, perform the following steps.
In the Azure portal, select your MySQL flexible server.
On the left pane, under Monitoring, select Server logs.
To enable server logs, under Server logs, select Enable.
You can also enable server logs in the Azure portal, on the Server parameters pane for your server, by setting the value of the log_output parameter to FILE. For more information on the log_output parameter, in the MySQL documentation, see topic Server System Variables (version 5.7 or version 8.0).
To enable the slow_query_log log, under Select logs to enable, select slow_query_log.
To configure slow_logs on your Azure Database for MySQL - Flexible Server, see Query Performance Insight.
Download Server logs
To download server logs, perform the following steps.
After enabling logs, the log files will be available to download after few minutes.
Under Name, select the log file you want to download, and then, under Action, select Download.
For HA enabled Azure Database for MySQL - Flexible Server, server logs for standby server can be identified by another four-letter identifier after the hostname of the server as shown below.
To download multiple log files at one time, under Name, select the files you want to download, and then above Name, select Download.
Disable Server Logs
From your Azure portal, select Server logs from Monitoring server pane.
For disabling Server logs to file, Uncheck Enable. (The setting will disable logging for all the log_types available)