Skip to content

Commit 16e7e36

Browse files
Merge pull request #267671 from code-sidd/auditlog
auditlogs
2 parents 7d9ed16 + b208e4c commit 16e7e36

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

articles/mysql/flexible-server/concepts-audit-logs.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@ By default, audit logs are disabled. To enable them, set the `audit_log_enabled`
2525
Other parameters you can adjust to control audit logging behavior include:
2626

2727
- `audit_log_events`: controls the events to be logged. See below table for specific audit events.
28-
- `audit_log_include_users`: MySQL users to be included for logging. The default value for this parameter is empty, which will include all the users for logging. This has higher priority over `audit_log_exclude_users`. Max length of the parameter is 512 characters.
29-
- `audit_log_exclude_users`: MySQL users to be excluded from logging. Max length of the parameter is 512 characters.
28+
- `audit_log_include_users`: MySQL users to be included for logging. The default value for this parameter is empty, which will include all the users for logging. This has higher priority over `audit_log_exclude_users`. Max length of the parameter is 512 characters. For example, wildcard value of `dev*` includes all the users with entries starting with keyword `dev` like "dev1,dev_user,dev_2". Another example for wildcard entry for including user is `*dev` in this example, all users ending with value "dev" like "stage_dev,prod_dev,user_dev" are included in the audit log entries. Additionally, the use of a question mark `(?)` as a wildcard character is permitted in patterns.
29+
- `audit_log_exclude_users`: MySQL users to be excluded from logging. The Max length of the parameter is 512 characters. Wildcard entries for user are also accepted to exclude users in audit logs. For example, wildcard value of `stage*` excludes all the users with entries starting with keyword `stage` like "stage1,stage_user,stage_2". Another example for wildcard entry for excluding user is `*com` in this example, all users ending with value `com` will be excluded from the audit log entries. Additionally, the use of a question mark `(?)` as a wildcard character is permitted in patterns.
3030

3131
> [!NOTE]
3232
> `audit_log_include_users` has higher priority over `audit_log_exclude_users`. For example, if `audit_log_include_users` = `demouser` and `audit_log_exclude_users` = `demouser`, the user will be included in the audit logs because `audit_log_include_users` has higher priority.
3333
3434
| **Event** | **Description** |
3535
| --- | --- |
36-
| `CONNECTION` | - Connection initiation (successful or unsuccessful)<br />- User reauthentication with different user/password during session<br />- Connection termination |
36+
| `CONNECTION` | - Connection initiation<br />- Connection termination |
37+
| `CONNECTION_V2` | - Connection initiation (successful or unsuccessful attempt error code)<br />- Connection termination<br /> |
3738
| `DML_SELECT` | SELECT queries |
3839
| `DML_NONSELECT` | INSERT/DELETE/UPDATE queries |
3940
| `DML` | DML = DML_SELECT + DML_NONSELECT |
@@ -77,6 +78,7 @@ The following sections describe the output of MySQL audit logs based on the even
7778
| `user_s` | Name of user executing the query |
7879
| `db_s` | Name of database connected to |
7980
| `\_ResourceId` | Resource URI |
81+
| `status_d` | Connection [Error code](https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html) entry for CONNECTIONS_V2 event. |
8082

8183
### General
8284

@@ -153,6 +155,17 @@ Once your audit logs are piped to Azure Monitor Logs through Diagnostic Logs, yo
153155
| order by TimeGenerated asc nulls last
154156
```
155157
158+
159+
- List CONNECTION_V2 events on a particular server, `status_d` column denotes the client connection [error code](https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html) faced by the client application while connecting.
160+
161+
```kusto
162+
AzureDiagnostics
163+
| where Resource == '<your server name>' //Server name must be in Upper case
164+
| where Category == 'MySqlAuditLogs' and event_subclass_s == "CONNECT"
165+
| project TimeGenerated, Resource, event_class_s, event_subclass_s, user_s, ip_s, status_d
166+
| order by TimeGenerated asc nulls last
167+
```
168+
156169
- List CONNECTION events on a particular server
157170
158171
```kusto

articles/mysql/flexible-server/whats-new.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ This article summarizes new releases and features in Azure Database for MySQL fl
2424
> [!NOTE]
2525
> This article references the term slave, which Microsoft no longer uses. When the term is removed from the software, we'll remove it from this article.
2626
27+
## February 2024
28+
29+
- **Audit logs now supports wild card entries**
30+
31+
The server parameters now supports wildcards in `audit_log_include_users` and `audit_log_exclude_users`, enhancing flexibility for specifying user inclusions and exclusions in audit logs. [Learn more](./concepts-audit-logs.md#configure-audit-logging)
32+
33+
- **Enhanced Audit Logging with CONNECTION_V2 for Comprehensive MySQL User Audits**
34+
35+
Server parameter [audit_log_events](./concepts-audit-logs.md#configure-audit-logging) now supports event CONNECTION_V2 for detailed connection logs, providing insights into user audits, connection status, and [error codes in MySQL](https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html) interactions.[Learn more](./concepts-audit-logs.md#analyze-logs-in-azure-monitor-logs)
36+
2737

2838
## December 2023
2939

0 commit comments

Comments
 (0)