Skip to content

Commit beb5331

Browse files
authored
Merge pull request #207009 from SudheeshGH/ServerLogs
Server Logs Documentation - New Feature
2 parents d09e677 + d81c593 commit beb5331

14 files changed

+214
-30
lines changed

articles/mysql/TOC.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@
210210
href: flexible-server/tutorial-configure-audit.md
211211
- name: Alerts
212212
href: flexible-server/how-to-alert-on-metric.md
213+
- name: Configuring Server logs
214+
items:
215+
- name: Azure portal
216+
href: flexible-server/how-to-server-logs-portal.md
217+
- name: Azure CLI
218+
href: flexible-server/how-to-server-logs-cli.md
213219
- name: Replication
214220
items:
215221
- name: Configure data-in replication

articles/mysql/flexible-server/concepts-monitoring.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,27 @@ ms.author: sisawant
99
ms.date: 9/21/2020
1010
---
1111

12-
# Monitor Azure Database for MySQL Flexible Servers with built-in metrics
12+
# Monitor Azure Database for MySQL Flexible Server
1313

1414
[!INCLUDE[applies-to-mysql-flexible-server](../includes/applies-to-mysql-flexible-server.md)]
1515

16-
Azure Database for MySQL Flexible Server provides monitoring of servers through Azure Monitor. Metrics are numerical values that describe some aspect of the resources of your server at a particular time. Monitoring your server's resources helps you troubleshoot and optimize your workload by allowing you to monitor what matters the most to you. Monitoring the right metrics helps you keep the performance, reliability, and availability of your server and applications.
16+
Azure Database for MySQL Flexible Server provides monitoring of servers through Azure Monitor. Monitoring data about your servers helps you troubleshoot and optimize for your workload.
1717

18-
In this article, you will learn about the various metrics available for your flexible server that give insight into the behavior of your server.
18+
In this article, you'll learn about the various metrics available and Server logs for your flexible server that give insight into the behavior of your server.
1919

2020
> [!NOTE]
2121
> This article contains references to the term *slave*, a term that Microsoft no longer uses. When the term is removed from the software, we'll remove it from this article.
2222
23-
## Available metrics
23+
## Metrics
2424

25-
Azure Database for MySQL Flexible Server provides various metrics to understand how your workload is performing and based on this data, you can understand the impact on your server and application. For example, in flexible server, you can monitor **Host CPU percent**, **Active Connections**, **IO percent**, and **Host Memory Percent** to identify when there is a performance impact. From there, you may have to optimize your workload, scale vertically by changing compute tiers, or scaling horizontally by using read replica.
25+
Metrics are numerical values that describe some aspect of the resources of your server at a particular time. Monitoring your server's resources helps you troubleshoot and optimize your workload by allowing you to monitor what matters the most to you. Monitoring the right metrics helps you keep the performance, reliability, and availability of your server and applications.
26+
27+
Azure Database for MySQL Flexible Server provides various metrics to understand how your workload is performing and based on this data, you can understand the impact on your server and application.
2628

2729
All Azure metrics have a one-minute frequency, and each metric provides 30 days of history. You can configure alerts on the metrics. For step-by-step guidance, see [How to set up alerts](./how-to-alert-on-metric.md). Other tasks include setting up automated actions, performing advanced analytics, and archiving history. For more information, see the [Azure Metrics Overview](../../azure-monitor/data-platform.md).
2830

29-
### List of metrics
31+
32+
## List of metrics
3033
These metrics are available for Azure Database for MySQL:
3134

3235
|Metric display name|Metric|Unit|Description|
@@ -46,6 +49,22 @@ These metrics are available for Azure Database for MySQL:
4649
|Aborted Connections|aborted_connections|Count|Total number of failed attempts to connect to your MySQL server, for example, failed connection due to bad credentials. For more information on aborted connections, you can refer to this [documentation](https://dev.mysql.com/doc/refman/5.7/en/communication-errors.html).|
4750
|Queries|queries|Count|Total number of queries executed per minute on your server. Total count of queries per minute on your server from your database workload and Azure MySQL processes.|
4851

52+
53+
## Server logs
54+
55+
In Azure Database for MySQL Server – Flexible Server, users can configure and download server logs to assist with troubleshooting efforts. With this feature enabled, a flexible server starts capturing events of the selected log type and writes them to a file. You can then use the Azure portal and Azure CLI to download the files to work with them.
56+
The server logs feature is disabled by default. For information about how to enable server logs, see [How to enable and download server logs for Azure Database for MySQL - Flexible Server](./how-to-server-logs-portal.md)
57+
58+
To perform a historical analysis of your data, in the Azure portal, on the Diagnostics settings pane for your server, add a diagnostic setting to send the logs to Log Analytics workspace, Azure Storage, or event hubs. For more information, see [Set up diagnostics](./tutorial-query-performance-insights.md#set-up-diagnostics).
59+
60+
**Server logs retention**
61+
62+
When logging is enabled for an Azure Database for MySQL flexible server, logs are available up to seven days from their creation.
63+
If the total size of the available logs exceeds 7 GB, then the oldest files are deleted until space is available.
64+
The 7-GB storage limit for server logs is available free of cost and can't be extended.
65+
Logs are rotated every 24 hours or 7 GB, whichever comes first.
66+
67+
4968
## Next steps
5069
- See [How to set up alerts](./how-to-alert-on-metric.md) for guidance on creating an alert on a metric.
51-
- Learn more about [scaling IOPS](./concepts/../concepts-compute-storage.md#iops) to improve performance.
70+
- How to enable and download server logs for Azure Database for MySQL - Flexible Server from [Azure portal](./how-to-server-logs-portal.md) or [Azure CLI](./how-to-server-logs-cli.md)
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: 'Monitoring - List and Download Server logs using Azure CLI'
3+
description: This article describes how to download and list server logs using Azure CLI.
4+
ms.service: mysql
5+
ms.subservice: flexible-server
6+
ms.topic: conceptual
7+
author: code-sidd
8+
ms.author: sisawant
9+
ms.date: 08/05/2022
10+
---
11+
# List and Download Server logs using Azure CLI
12+
13+
[[!INCLUDE[applies-to-mysql-flexible-server](../includes/applies-to-mysql-flexible-server.md)]
14+
15+
This article shows you how to list and download server flexible server using Azure CLI.
16+
17+
## Prerequisites
18+
19+
This article requires that you're running the Azure CLI version 2.39.0 or later locally. To see the version installed, run the `az --version` command. If you need to install or upgrade, see [Install Azure CLI](/cli/azure/install-azure-cli).
20+
21+
You'll need to sign-in to your account using the [az sign-in](/cli/azure/reference-index#az-login) command. Note the **id** property, which refers to **Subscription ID** for your Azure account.
22+
23+
```azurecli-interactive
24+
az login
25+
```
26+
27+
Select the specific subscription under your account using [az account set](/cli/azure/account) command. Make a note of the **id** value from the **az login** output to use as the value for **subscription** argument in the command. If you have multiple subscriptions, choose the appropriate subscription in which the resource should be billed. To get all your subscription, use [az account list](/cli/azure/account#az-account-list).
28+
29+
```azurecli
30+
az account set --subscription <subscription id>
31+
```
32+
33+
## List Server logs using Azure CLI
34+
35+
Once you're configured the prerequisites and connected to your required subscription.
36+
You can list the server logs from your flexible server by below command.
37+
38+
39+
```azurecli
40+
az mysql flexible-server server-logs list --resource-group <myresourcegroup> --server-name <serverlogdemo> --out <table>
41+
```
42+
43+
Here are the details for the above command
44+
45+
LastModifiedTime | Name | ResourceGroup | SizeInKb | TypePropertiesType | Url
46+
---|---|---|---|---|---|
47+
2022-08-01T11:09:48+00:00 | mysql-slow-serverlogdemo-2022073111.log | myresourcegroup | 10947 | slowlog | https://00000000000.file.core.windows.net/0000000serverlog/slowlogs/mysql-slow-serverlogdemo-2022073111.log?
48+
2022-08-02T11:10:00+00:00 | mysql-slow-serverlogdemo-2022080111.log | myresourcegroup | 10927 | slowlog | https://00000000000.file.core.windows.net/0000000serverlog/slowlogs/mysql-slow-serverlogdemo-2022080111.log?
49+
2022-08-03T11:10:12+00:00 | mysql-slow-serverlogdemo-2022080211.log | myresourcegroup | 10936 | slowlog | https://00000000000.file.core.windows.net/0000000serverlog/slowlogs/mysql-slow-serverlogdemo-2022080211.log?
50+
2022-08-03T11:12:00+00:00 | mysql-slow-serverlogdemo-2022080311.log | myresourcegroup | 8920 | slowlog | https://00000000000.file.core.windows.net/0000000serverlog/slowlogs/mysql-slow-serverlogdemo-2022080311.log?
51+
52+
53+
Above list shows LastModifiedTime, Name, ResourceGroup, SizeInKb and Download Url of the Server Logs available.
54+
Default LastModifiedTime is set to 72 hours, for listing files older than 72 hours, use flag `--file-last-written <Time:HH>`
55+
56+
```azurecli
57+
az mysql flexible-server server-logs list --resource-group <myresourcegroup> --server-name <serverlogdemo> --out table --file-last-written <144>
58+
```
59+
60+
## Downloading Server logs using Azure CLI
61+
62+
Below command will download the mentioned server logs to your current directory.
63+
64+
```azurecli
65+
az mysql flexible-server server-logs download --resource-group <myresourcegroup> --server-name <serverlogdemo> --name <mysql-slow-serverlogdemo-2022073111.log>
66+
```
67+
68+
## Next Steps
69+
- To enable and disable Server logs from portal, you can refer to the [article].(./how-to-server-logs-portal.md)
70+
- Learn more about [Configure slow logs using Azure CLI](./tutorial-query-performance-insights.md#configure-slow-query-logs-by-using-the-azure-cli)
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
title: 'How to enable and download server logs for Azure Database for MySQL - Flexible Server'
3+
description: This article describes how to download and list server logs using Azure portal.
4+
ms.service: mysql
5+
ms.subservice: flexible-server
6+
ms.topic: conceptual
7+
author: code-sidd
8+
ms.author: sisawant
9+
ms.date: 08/05/2022
10+
---
11+
# Enable, list and download server logs for Azure Database for MySQL - Flexible Server
12+
13+
[!INCLUDE[applies-to-mysql-flexible-server](../includes/applies-to-mysql-flexible-server.md)]
14+
15+
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.
16+
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.
17+
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.
18+
19+
In this tutorial, you’ll learn how to:
20+
- Enable the server logs feature.
21+
- Disable the server logs feature.
22+
- Download server log files.
23+
24+
## Prerequisites
25+
26+
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](./quickstart-create-server-portal.md).
27+
28+
## Enable Server logs
29+
30+
To enable the server logs feature, perform the following steps.
31+
32+
1. In the [Azure portal](https://portal.azure.com), select your MySQL flexible server.
33+
34+
2. On the left pane, under **Monitoring**, select **Server logs**.
35+
36+
:::image type="content" source="./media/how-to-server-logs-portal/1-how-to-serverlog.png" alt-text="Screenshot showing Azure Database for My SQL - Server Logs.":::
37+
38+
3. To enable server logs, under **Server logs**, select **Enable**.
39+
40+
:::image type="content" source="./media/how-to-server-logs-portal/2-how-to-serverlog.png" alt-text="Screenshot showing Enable Server Logs.":::
41+
42+
>[!Note]
43+
> You can also enable server logs in the Azure portal, on the [Server parameters](./how-to-configure-server-parameters-portal.md) pane for your server, by setting the value of the log_output parameter to FILE.
44+
> For more information on the log_output parameter, in the MySQL documentation, see topic Server System Variables ([version 5.7](https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_log_output) or [version 8.0](https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_log_output)).
45+
46+
4. To enable the slow_query_log log, under **Select logs to enable**, select **slow_query_log**.
47+
48+
:::image type="content" source="./media/how-to-server-logs-portal/3-how-to-serverlog.png" alt-text="Screenshot showing select slow log - Server Logs.":::
49+
50+
To configure slow_logs on your Azure Database for MySQL flexible server, see [Query Performance Insight.](./tutorial-query-performance-insights.md)
51+
52+
53+
## Download Server logs
54+
55+
To download server logs, perform the following steps.
56+
> [!Note]
57+
> After enabling logs, the log files will be available to download after few minutes.
58+
59+
1. Under **Name**, select the log file you want to download, and then, under **Action**, select **Download**.
60+
61+
:::image type="content" source="./media/how-to-server-logs-portal/4-how-to-serverlog.png" alt-text="Screenshot showing Server Logs - Download.":::
62+
63+
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.
64+
65+
:::image type="content" source="./media/how-to-server-logs-portal/5-how-to-serverlog.png" alt-text="Screenshot showing server Logs - HA logs.":::
66+
67+
2. To download multiple log files at one time, under **Name**, select the files you want to download, and then above **Name**, select **Download**.
68+
69+
:::image type="content" source="./media/how-to-server-logs-portal/6-how-to-serverlog.png" alt-text="Screenshot showing server Logs - Download all.":::
70+
71+
72+
## Disable Server Logs
73+
74+
1. From your Azure portal, select Server logs from Monitoring server pane.
75+
76+
2. For disabling Server logs to file, Uncheck Enable. (The setting will disable logging for all the log_types available)
77+
78+
:::image type="content" source="./media/how-to-server-logs-portal/7-how-to-serverlog.png" alt-text="Screenshot showing server Logs - Disable.":::
79+
80+
3. Select Save
81+
82+
:::image type="content" source="./media/how-to-server-logs-portal/8-how-to-serverlog.png" alt-text="Screenshot showing server Logs - Save.":::
83+
84+
85+
## Next steps
86+
- Learn more about [How to enable slow query logs](./tutorial-query-performance-insights.md#configure-slow-query-logs-by-using-the-azure-portal)
87+
- List and download [Server logs using Azure CLI](./how-to-server-logs-cli.md)
17.3 KB
Loading
11.7 KB
Loading
11.8 KB
Loading
22.1 KB
Loading
9.6 KB
Loading
17 KB
Loading

0 commit comments

Comments
 (0)