Skip to content

Commit 2aeecad

Browse files
authored
Merge pull request #79443 from ajlam/audit-log-preview
Audit log preview for MariaDB
2 parents d09ca8b + 5b09d3d commit 2aeecad

15 files changed

+224
-22
lines changed

articles/mariadb/TOC.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@
6363
items:
6464
- name: Monitor
6565
href: concepts-monitoring.md
66-
- name: Server logs
66+
- name: Slow query logs
6767
href: concepts-server-logs.md
68+
- name: Audit logs
69+
href: concepts-audit-logs.md
6870
- name: Development
6971
items:
7072
- name: Drivers and tools compatibility
@@ -112,13 +114,19 @@
112114
- name: Auto grow storage
113115
items:
114116
- name: Azure portal
115-
href: howto-auto-grow-storage-portal.md
117+
href: howto-auto-grow-storage-portal.md
116118
- name: Access server logs
117119
items:
118-
- name: Azure portal
119-
href: howto-configure-server-logs-portal.md
120-
- name: Azure CLI
121-
href: howto-configure-server-logs-cli.md
120+
- name: Slow query logs
121+
items:
122+
- name: Azure portal
123+
href: howto-configure-server-logs-portal.md
124+
- name: Azure CLI
125+
href: howto-configure-server-logs-cli.md
126+
- name: Audit logs
127+
items:
128+
- name: Azure portal
129+
href: howto-configure-audit-logs-portal.md
122130
- name: Monitor
123131
items:
124132
- name: Create alerts on metrics
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
title: Audit logs for Azure Database for MariaDB
3+
description: Describes the audit logs available in Azure Database for MariaDB, and the available parameters for enabling logging levels.
4+
author: ajlam
5+
ms.author: andrela
6+
ms.service: mariadb
7+
ms.topic: conceptual
8+
ms.date: 06/11/2019
9+
---
10+
11+
# Audit Logs in Azure Database for MariaDB
12+
13+
In Azure Database for MariaDB, the audit log is available to users. The audit log can be used to track database-level activity and is commonly used for compliance.
14+
15+
> [!IMPORTANT]
16+
> Audit log functionality is currently in preview.
17+
18+
## Configure audit logging
19+
20+
By default the audit log is disabled. To enable it, set `audit_log_enabled` to ON.
21+
22+
Other parameters you can adjust include:
23+
24+
- `audit_log_events`: controls the events to be logged. See below table for specific audit events.
25+
- `audit_log_exclude_users`: MariaDB users to be excluded from logging. Allows for at most four users. Max length of the parameter is 256 characters.
26+
27+
| **Event** | **Description** |
28+
|---|---|
29+
| `CONNECTION` | - Connection initiation (successful or unsuccessful) <br> - User reauthentication with different user/password during session <br> - Connection termination |
30+
| `DML_SELECT`| SELECT queries |
31+
| `DML_NONSELECT` | INSERT/DELETE/UPDATE queries |
32+
| `DML` | DML = DML_SELECT + DML_NONSELECT |
33+
| `DDL` | Queries like "DROP DATABASE" |
34+
| `DCL` | Queries like "GRANT PERMISSION" |
35+
| `ADMIN` | Queries like "SHOW STATUS" |
36+
| `GENERAL` | All in DML_SELECT, DML_NONSELECT, DML, DDL, DCL, and ADMIN |
37+
38+
## Access audit logs
39+
40+
Audit logs are integrated with Azure Monitor Diagnostic Logs. Once you've enabled audit logs on your MariaDB server, you can emit them to Azure Monitor logs, Event Hubs, or Azure Storage. To learn more about how to enable diagnostic logs in the Azure portal, see the [audit log portal article](howto-configure-audit-logs-portal.md#set-up-diagnostic-logs).
41+
42+
## Schemas
43+
44+
The following sections describe what's output by MariaDB audit logs based on the event type. Depending on the output method, the fields included and the order in which they appear may vary.
45+
46+
### Connection
47+
48+
| **Property** | **Description** |
49+
|---|---|
50+
| `TenantId` | Your tenant ID |
51+
| `SourceSystem` | `Azure` |
52+
| `TimeGenerated` [UTC] | Time stamp when the log was recorded in UTC |
53+
| `Type` | Type of the log. Always `AzureDiagnostics` |
54+
| `SubscriptionId` | GUID for the subscription that the server belongs to |
55+
| `ResourceGroup` | Name of the resource group the server belongs to |
56+
| `ResourceProvider` | Name of the resource provider. Always `MICROSOFT.DBFORMARIADB` |
57+
| `ResourceType` | `Servers` |
58+
| `ResourceId` | Resource URI |
59+
| `Resource` | Name of the server |
60+
| `Category` | `MySqlAuditLogs` |
61+
| `OperationName` | `LogEvent` |
62+
| `event_class` | `connection_log` |
63+
| `event_subclass` | `CONNECT`, `DISCONNECT` |
64+
| `connection_id` | Unique connection ID generated by MariaDB |
65+
| `host` | Blank |
66+
| `ip` | IP address of client connecting to MariaDB |
67+
| `user` | Name of user executing the query |
68+
| `db` | Name of database connected to |
69+
| `\_ResourceId` | Resource URI |
70+
71+
### General
72+
73+
Schema below applies to GENERAL, DML_SELECT, DML_NONSELECT, DML, DDL, DCL, and ADMIN event types.
74+
75+
| **Property** | **Description** |
76+
|---|---|
77+
| `TenantId` | Your tenant ID |
78+
| `SourceSystem` | `Azure` |
79+
| `TimeGenerated` [UTC] | Time stamp when tshe log was recorded in UTC |
80+
| `Type` | Type of the log. Always `AzureDiagnostics` |
81+
| `SubscriptionId` | GUID for the subscription that the server belongs to |
82+
| `ResourceGroup` | Name of the resource group the server belongs to |
83+
| `ResourceProvider` | Name of the resource provider. Always `MICROSOFT.DBFORMARIADB` |
84+
| `ResourceType` | `Servers` |
85+
| `ResourceId` | Resource URI |
86+
| `Resource` | Name of the server |
87+
| `Category` | `MySqlAuditLogs` |
88+
| `OperationName` | `LogEvent` |
89+
| `event_class` | `general_log` |
90+
| `event_subclass` | `LOG`, `ERROR`, `RESULT` |
91+
| `event_time` | Query start seconds in UNIX timestamp |
92+
| `error_code` | Error code if query failed. `0` means no error |
93+
| `thread_id` | ID of thread that executed the query |
94+
| `host` | Blank |
95+
| `ip` | IP address of client connecting to MariaDB |
96+
| `user` | Name of user executing the query |
97+
| `sql_text` | Full query text |
98+
| `\_ResourceId` | Resource URI |
99+
100+
### Table access
101+
102+
| **Property** | **Description** |
103+
|---|---|
104+
| `TenantId` | Your tenant ID |
105+
| `SourceSystem` | `Azure` |
106+
| `TimeGenerated` [UTC] | Time stamp when the log was recorded in UTC |
107+
| `Type` | Type of the log. Always `AzureDiagnostics` |
108+
| `SubscriptionId` | GUID for the subscription that the server belongs to |
109+
| `ResourceGroup` | Name of the resource group the server belongs to |
110+
| `ResourceProvider` | Name of the resource provider. Always `MICROSOFT.DBFORMARIADB` |
111+
| `ResourceType` | `Servers` |
112+
| `ResourceId` | Resource URI |
113+
| `Resource` | Name of the server |
114+
| `Category` | `MySqlAuditLogs` |
115+
| `OperationName` | `LogEvent` |
116+
| `event_class` | `table_access_log` |
117+
| `event_subclass` | `READ`, `INSERT`, `UPDATE`, or `DELETE` |
118+
| `connection_id` | Unique connection ID generated by MariaDB |
119+
| `db` | Name of database accessed |
120+
| `table` | Name of table accessed |
121+
| `sql_text` | Full query text |
122+
| `\_ResourceId` | Resource URI |
123+
124+
## Next steps
125+
126+
- [How to configure audit logs in the Azure portal](howto-configure-audit-logs-portal.md)

articles/mariadb/concepts-server-logs.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ author: rachel-msft
55
ms.author: raagyema
66
ms.service: mariadb
77
ms.topic: conceptual
8-
ms.date: 04/29/2019
8+
ms.date: 06/12/2019
99
---
10-
# Server Logs in Azure Database for MariaDB
10+
# 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.
1212

1313
For more information about the slow query log, see the MariaDB documentation for [slow query log](https://mariadb.com/kb/en/library/slow-query-log-overview/).
1414

15-
## Access server logs
16-
You can list and download Azure Database for MariaDB server logs using the Azure portal, and the Azure CLI.
15+
## Access slow query logs
16+
You can list and download Azure Database for MariaDB slow query logs using the Azure portal, and the Azure CLI.
1717

1818
In the Azure portal, select your Azure Database for MariaDB server. Under the **Monitoring** heading, select the **Server Logs** page.
1919

@@ -24,7 +24,7 @@ Logs are available for up to seven days from their creation. If the total size o
2424

2525
Logs are rotated every 24 hours or 7 GB, whichever comes first.
2626

27-
## Configure logging
27+
## Configure slow query logging
2828
By default the slow query log is disabled. To enable it, set slow_query_log to ON.
2929

3030
Other parameters you can adjust include:
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: Configure and access audit logs for Azure Database for MariaDB in Azure portal
3+
description: This article describes how to configure and access the audit logs in Azure Database for MariaDB from the Azure portal.
4+
author: ajlam
5+
ms.author: andrela
6+
ms.service: mariadb
7+
ms.topic: conceptual
8+
ms.date: 06/11/2019
9+
---
10+
11+
# Configure and access audit logs in the Azure portal
12+
13+
You can configure the [Azure Database for MariaDB audit logs](concepts-audit-logs.md) and diagnostic settings from the Azure portal.
14+
15+
> [!IMPORTANT]
16+
> Audit log functionality is currently in preview.
17+
18+
## Prerequisites
19+
20+
To step through this how-to guide, you need:
21+
22+
- [Azure Database for MariaDB server](quickstart-create-mariadb-server-database-using-azure-portal.md)
23+
24+
## Configure audit logging
25+
26+
Enable and configure audit logging.
27+
28+
1. Sign in to the [Azure portal](https://portal.azure.com/).
29+
30+
1. Select your Azure Database for MariaDB server.
31+
32+
1. Under the **Settings** section in the sidebar, select **Server parameters**.
33+
![Server parameters](./media/howto-configure-audit-logs-portal/server-parameters.png)
34+
35+
1. Update the **audit_log_enabled** parameter to ON.
36+
![Enable audit logs](./media/howto-configure-audit-logs-portal/audit-log-enabled.png)
37+
38+
1. Select the events to be logged by updating the **audit_log_events** parameter.
39+
![Audit log events](./media/howto-configure-audit-logs-portal/audit-log-events.png)
40+
41+
1. Add any MariaDB users to be excluded from logging by updating the **audit_log_exclude_users** parameter. Specify users by providing their MariaDB user name.
42+
![Audit log exclude users](./media/howto-configure-audit-logs-portal/audit-log-exclude-users.png)
43+
44+
1. Once you have changed the parameters, you can click **Save**. Or you can **Discard** your changes.
45+
![Save](./media/howto-configure-audit-logs-portal/save-parameters.png)
46+
47+
## Set up diagnostic logs
48+
49+
1. Under the **Monitoring** section in the sidebar, select **Diagnostic settings**.
50+
51+
1. Click on "+ Add diagnostic setting"
52+
![Add diagnostic setting](./media/howto-configure-audit-logs-portal/add-diagnostic-setting.png)
53+
54+
1. Provide a diagnostic setting name.
55+
56+
1. Specify which data sinks to send the audit logs (storage account, event hub, and/or Log Analytics workspace).
57+
58+
1. Select "MySqlAuditLogs" as the log type.
59+
![Configure diagnostic setting](./media/howto-configure-audit-logs-portal/configure-diagnostic-setting.png)
60+
61+
1. Once you've configured the data sinks to pipe the audit logs to, you can click **Save**.
62+
![Save diagnostic setting](./media/howto-configure-audit-logs-portal/save-diagnostic-setting.png)
63+
64+
1. Access the audit logs by exploring them in the data sinks you configured. It may take up to 10 minutes for the logs to appear.
65+
66+
## Next steps
67+
68+
- Learn more about [audit logs](concepts-audit-logs.md) in Azure Database for MariaDB.

articles/mariadb/howto-configure-server-logs-cli.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: raagyema
66
ms.service: mariadb
77
ms.devlang: azurecli
88
ms.topic: conceptual
9-
ms.date: 11/10/2018
9+
ms.date: 06/12/2019
1010
---
1111
# Configure and access server logs by using Azure CLI
1212
You can download the Azure Database for MariaDB server logs by using Azure CLI, the Azure command-line utility.
@@ -32,7 +32,7 @@ az mariadb server configuration list --resource-group myresourcegroup --server m
3232
```
3333

3434
## List logs for Azure Database for MariaDB server
35-
To list the available log files for your server, run the [az mariadb server-logs list](/cli/azure/mariadb/server-logs#az-mariadb-server-logs-list) command.
35+
To list the available slow query log files for your server, run the [az mariadb server-logs list](/cli/azure/mariadb/server-logs#az-mariadb-server-logs-list) command.
3636

3737
You can list the log files for server **mydemoserver.mariadb.database.azure.com** under the resource group **myresourcegroup**. Then direct the list of log files to a text file called **log\_files\_list.txt**.
3838
```azurecli-interactive
@@ -47,4 +47,4 @@ az mariadb server-logs download --name mysql-slow-mydemoserver-2018110800.log --
4747
```
4848

4949
## Next steps
50-
- Learn about [server logs in Azure Database for MariaDB](concepts-server-logs.md).
50+
- Learn about [slow query logs in Azure Database for MariaDB](concepts-server-logs.md).

articles/mariadb/howto-configure-server-logs-portal.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
title: Configure and access server logs for Azure Database for MariaDB in Azure Portal
3-
description: This article describes how to configure and access the server logs in Azure Database for MariaDB from the Azure Portal.
2+
title: Configure and access server logs for Azure Database for MariaDB in Azure portal
3+
description: This article describes how to configure and access the server logs in Azure Database for MariaDB from the Azure portal.
44
author: rachel-msft
55
ms.author: raagyema
66
ms.service: mariadb
77
ms.topic: conceptual
8-
ms.date: 09/24/2018
8+
ms.date: 06/11/2019
99
---
1010

1111
# Configure and access server logs in the Azure portal
1212

13-
You can configure, list, and download the [Azure Database for MariaDB server logs](concepts-server-logs.md) from the Azure portal.
13+
You can configure, list, and download the [Azure Database for MariaDB slow query logs](concepts-server-logs.md) from the Azure portal.
1414

1515
## Prerequisites
1616
To step through this how-to guide, you need:
@@ -37,7 +37,7 @@ Configure access to the slow query log.
3737
6. Return to the list of logs by clicking the **close button** (X icon) on the **Server Parameters** page.
3838

3939
## View list and download logs
40-
Once logging begins, you can view a list of available logs and download individual log files on the Server Logs pane.
40+
Once logging begins, you can view a list of available slow query logs and download individual log files on the Server Logs pane.
4141

4242
1. Open the Azure portal.
4343

@@ -57,7 +57,7 @@ Once logging begins, you can view a list of available logs and download individu
5757
![Click download icon](./media/howto-configure-server-logs-portal/5-download.png)
5858

5959
## Next steps
60-
- Learn more about [Server Logs](concepts-server-logs.md) in Azure Database for MariaDB.
60+
- Learn more about [slow query Logs](concepts-server-logs.md) in Azure Database for MariaDB.
6161
- For more information about the parameter definitions and logging, see the MariaDB documentation on [Logs](https://mariadb.com/kb/en/library/slow-query-log-overview/).
6262

63-
<!-- - See [Access Server Logs in CLI](howto-configure-server-logs-in-cli.md) to learn how to download logs programmatically. -->
63+
<!--- See [Access Server Logs in CLI](howto-configure-server-logs-in-cli.md) to learn how to download logs programmatically. -->
145 KB
Loading
288 KB
Loading
296 KB
Loading
289 KB
Loading

0 commit comments

Comments
 (0)