Skip to content

Commit 39718b9

Browse files
authored
Improve the database audit log feature (pingcap#11264)
1 parent dd8dc91 commit 39718b9

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

TOC-tidb-cloud.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,11 @@
164164
- [Overview](/garbage-collection-overview.md)
165165
- [Configuration](/garbage-collection-configuration.md)
166166
- [Tune TiFlash performance](/tiflash/tune-tiflash-performance.md)
167-
- Manage User Access
167+
- Security
168168
- [Manage Console User Access](/tidb-cloud/manage-user-access.md)
169169
- [Configure Cluster Security Settings](/tidb-cloud/configure-security-settings.md)
170+
- [Database Audit Logging](/tidb-cloud/tidb-cloud-auditing.md)
171+
- [Secure Connections to Serverless Tier Clusters](/tidb-cloud/secure-connections-to-serverless-tier-clusters.md)
170172
- Billing
171173
- [Invoices](/tidb-cloud/tidb-cloud-billing.md#invoices)
172174
- [Billing Details](/tidb-cloud/tidb-cloud-billing.md#billing-details)
@@ -422,7 +424,6 @@
422424
- [Dumpling](/dumpling-overview.md)
423425
- [Table Filter](/table-filter.md)
424426
- [Troubleshoot Inconsistency Between Data and Indexes](/troubleshoot-data-inconsistency-errors.md)
425-
- [Secure Connections to Serverless Tier Clusters](/tidb-cloud/secure-connections-to-serverless-tier-clusters.md)
426427
- [FAQs](/tidb-cloud/tidb-cloud-faq.md)
427428
- Release Notes
428429
- [2022](/tidb-cloud/release-notes-2022.md)

tidb-cloud/tidb-cloud-auditing.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ summary: Learn about how to audit a cluster in TiDB Cloud.
77

88
TiDB Cloud provides you with a database audit logging feature to record a history of user access details (such as any SQL statements executed) in logs.
99

10-
> **Note:**
11-
>
12-
> Currently, the **audit logging** feature is experimental. The interface and output are subject to change.
13-
1410
To assess the effectiveness of user access policies and other information security measures of your organization, it is a security best practice to conduct a periodic analysis of the database audit logs.
1511

1612
The audit logging feature is disabled by default. To audit a cluster, you need to enable the audit logging first, and then specify the auditing filter rules.
@@ -21,7 +17,7 @@ The audit logging feature is disabled by default. To audit a cluster, you need t
2117
2218
## Prerequisites
2319

24-
- You are using a TiDB Cloud Dedicated tier. Audit logging is not available for TiDB Cloud Serverless Tier clusters.
20+
- You are using a TiDB Cloud Dedicated Tier cluster. Audit logging is not available for TiDB Cloud Serverless Tier clusters.
2521
- You are the audit administrator of your organization in TiDB Cloud. Otherwise, you cannot see the audit-related options in the TiDB Cloud console. For more information, see [Configure member roles](/tidb-cloud/manage-user-access.md#configure-member-roles).
2622

2723
## Enable audit logging for AWS or GCP
@@ -47,18 +43,16 @@ For more information, see [Creating a bucket](https://docs.aws.amazon.com/Amazon
4743
1. Get the TiDB Cloud account ID and the External ID of the TiDB cluster that you want to enable audit logging.
4844

4945
1. In the TiDB Cloud console, choose a project and a cluster deployed on AWS.
50-
2. Select **Settings** > **Audit Settings**. The **Audit Logging** dialog box is displayed.
51-
3. In the **Audit Logging** dialog box, click **Show AWS IAM policy settings**. The corresponding TiDB Cloud Account ID and TiDB Cloud External ID of the TiDB cluster are displayed.
46+
2. Select **Settings** > **Audit Settings**. The **Audit Logging** dialog is displayed.
47+
3. In the **Audit Logging** dialog, click **Show AWS IAM policy settings**. The corresponding TiDB Cloud Account ID and TiDB Cloud External ID of the TiDB cluster are displayed.
5248
4. Record the TiDB Cloud Account ID and the External ID for later use.
5349

54-
2. In the AWS Management console, go to **IAM** > **Access Management** > **Policies**, and then check whether a storage bucket policy with the `s3:PutObject` write-only permission exists.
50+
2. In the AWS Management console, go to **IAM** > **Access Management** > **Policies**, and then check whether there is a storage bucket policy with the `s3:PutObject` write-only permission.
5551

5652
- If yes, record the matched storage bucket policy for later use.
5753
- If not, go to **IAM** > **Access Management** > **Policies** > **Create Policy**, and define a bucket policy according to the following policy template.
5854

59-
{{< copyable "" >}}
60-
61-
```
55+
```json
6256
{
6357
"Version": "2012-10-17",
6458
"Statement": [
@@ -71,7 +65,7 @@ For more information, see [Creating a bucket](https://docs.aws.amazon.com/Amazon
7165
}
7266
```
7367

74-
In the template, `<Your S3 bucket ARN>` is the Amazon Resource Name (ARN) of your S3 bucket where the audit log files are to be written. You can go to the **Properties** tab in your S3 bucket and get the Amazon Resource Name (ARN) value in the **Bucket Overview** area. In the `"Resource"` field, you need to add `/*` after the ARN. For example, if the ARN is `arn:aws:s3:::tidb-cloud-test`, you need to configure the value of the `"Resource"` field as `"arn:aws:s3:::tidb-cloud-test/*"`.
68+
In the template, `<Your S3 bucket ARN>` is the Amazon Resource Name (ARN) of your S3 bucket where the audit log files are to be written. You can go to the **Properties** tab in your S3 bucket and get the ARN value in the **Bucket Overview** area. In the `"Resource"` field, you need to add `/*` after the ARN. For example, if the ARN is `arn:aws:s3:::tidb-cloud-test`, you need to configure the value of the `"Resource"` field as `"arn:aws:s3:::tidb-cloud-test/*"`.
7569

7670
3. Go to **IAM** > **Access Management** > **Roles**, and then check whether a role whose trust entity corresponds to the TiDB Cloud Account ID and the External ID that you recorded earlier already exists.
7771

@@ -189,6 +183,10 @@ For example, `13796619446086334065/tidb-0/tidb-audit-2022-04-21T18-16-29.529.log
189183

190184
If you no longer want to audit a cluster, go to the page of the cluster, click **Settings** > **Audit Settings**, and then toggle the audit setting in the upper-right corner to **Off**.
191185

186+
> **Note:**
187+
>
188+
> Each time the size of the log file reaches 10 MiB, the log file will be pushed to the cloud storage bucket. Therefore, after the audit log is disabled, the log file whose size is smaller than 10 MiB will not be automatically pushed to the cloud storage bucket. To get the log file in this situation, contact [PingCAP support](/tidb-cloud/tidb-cloud-support.md).
189+
192190
## Audit log fields
193191

194192
For each database event record in audit logs, TiDB provides the following fields:

0 commit comments

Comments
 (0)