Skip to content

Commit 14a4d28

Browse files
committed
add mariadb
1 parent 430fde6 commit 14a4d28

File tree

2 files changed

+66
-5
lines changed

2 files changed

+66
-5
lines changed

articles/mariadb/concepts-server-logs.md

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: ajlam
55
ms.author: andrela
66
ms.service: mariadb
77
ms.topic: conceptual
8-
ms.date: 12/17/2019
8+
ms.date: 01/21/2020
99
---
1010
# Slow query logs in Azure Database for MariaDB
1111
In Azure Database for MariaDB, the slow query log is available to users. Access to the transaction log is not supported. The slow query log can be used to identify performance bottlenecks for troubleshooting.
@@ -37,6 +37,10 @@ Other parameters you can adjust include:
3737
- **log_throttle_queries_not_using_indexes**: This parameter limits the number of non-index queries that can be written to the slow query log. This parameter takes effect when log_queries_not_using_indexes is set to ON.
3838
- **log_output**: if "File", allows the slow query log to be written to both the local server storage and to Azure Monitor Diagnostic Logs. If "None", the slow query log will only be written to Azure Monitor Diagnostics Logs.
3939

40+
> [!IMPORTANT]
41+
> If your tables are not indexed, setting the `log_queries_not_using_indexes` and `log_throttle_queries_not_using_indexes` parameters to ON may affect MariaDB performance since all queries running against these non-indexed tables will be written to the slow query log.<br><br>
42+
> If you plan on logging slow queries for an extended period of time, it is recommended to set `log_output` to "None". If set to "File", these logs are written to the local server storage and can affect MariaDB performance.
43+
4044
See the MariaDB [slow query log documentation](https://mariadb.com/kb/en/library/slow-query-log-overview/) for full descriptions of the slow query log parameters.
4145

4246
## Diagnostic logs
@@ -75,5 +79,61 @@ The following table describes what's in each log. Depending on the output method
7579
| `thread_id_s` | Thread ID |
7680
| `\_ResourceId` | Resource URI |
7781

78-
## Next steps
79-
- [How to configure and access server logs from the Azure portal](howto-configure-server-logs-portal.md).
82+
## Analyze logs in Azure Monitor Logs
83+
84+
Once your slow query logs are piped to Azure Monitor Logs through Diagnostic Logs, you can perform further analysis of your slow queries. Below are some sample queries to help you get started. Make sure to update the below with your server name.
85+
86+
- Queries longer than 10 seconds on a particular server
87+
88+
```Kusto
89+
AzureDiagnostics
90+
| where LogicalServerName_s == '<your server name>'
91+
| where Category == 'MySqlSlowLogs'
92+
| project TimeGenerated, LogicalServerName_s, event_class_s, start_time_t , query_time_d, sql_text_s
93+
| where query_time_d > 10
94+
```
95+
96+
- List top 5 longest queries on a particular server
97+
98+
```Kusto
99+
AzureDiagnostics
100+
| where LogicalServerName_s == '<your server name>'
101+
| where Category == 'MySqlSlowLogs'
102+
| project TimeGenerated, LogicalServerName_s, event_class_s, start_time_t , query_time_d, sql_text_s
103+
| order by query_time_d desc
104+
| take 5
105+
```
106+
107+
- Summarize slow queries by minimum, maximum, average, and standard deviation query time on a particular server
108+
109+
```Kusto
110+
AzureDiagnostics
111+
| where LogicalServerName_s == '<your server name>'
112+
| where Category == 'MySqlSlowLogs'
113+
| project TimeGenerated, LogicalServerName_s, event_class_s, start_time_t , query_time_d, sql_text_s
114+
| summarize count(), min(query_time_d), max(query_time_d), avg(query_time_d), stdev(query_time_d), percentile(query_time_d, 95) by LogicalServerName_s
115+
```
116+
117+
- Graph the slow query distribution on a particular server
118+
119+
```Kusto
120+
AzureDiagnostics
121+
| where LogicalServerName_s == '<your server name>'
122+
| where Category == 'MySqlSlowLogs'
123+
| project TimeGenerated, LogicalServerName_s, event_class_s, start_time_t , query_time_d, sql_text_s
124+
| summarize count() by LogicalServerName_s, bin(TimeGenerated, 5m)
125+
| render timechart
126+
```
127+
128+
- Display queries longer than 10 seconds across all MariaDB servers with Diagnostic Logs enabled
129+
130+
```Kusto
131+
AzureDiagnostics
132+
| where Category == 'MySqlSlowLogs'
133+
| project TimeGenerated, LogicalServerName_s, event_class_s, start_time_t , query_time_d, sql_text_s
134+
| where query_time_d > 10
135+
```
136+
137+
## Next Steps
138+
- [How to configure slow query logs from the Azure portal](howto-configure-server-logs-portal.md)
139+
- [How to configure slow query logs from the Azure CLI](howto-configure-server-logs-cli.md)

articles/mysql/concepts-server-logs.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: ajlam
55
ms.author: andrela
66
ms.service: mysql
77
ms.topic: conceptual
8-
ms.date: 12/17/2019
8+
ms.date: 01/21/2020
99
---
1010
# Slow query logs in Azure Database for MySQL
1111
In Azure Database for MySQL, the slow query log is available to users. Access to the transaction log is not supported. The slow query log can be used to identify performance bottlenecks for troubleshooting.
@@ -138,4 +138,5 @@ Once your slow query logs are piped to Azure Monitor Logs through Diagnostic Log
138138
```
139139
140140
## Next Steps
141-
- [How to configure and access server logs from the Azure CLI](howto-configure-server-logs-in-cli.md).
141+
- [How to configure slow query logs from the Azure portal](howto-configure-server-logs-in-portal.md)
142+
- [How to configure slow query logs from the Azure CLI](howto-configure-server-logs-in-cli.md).

0 commit comments

Comments
 (0)