-
Notifications
You must be signed in to change notification settings - Fork 692
TiDB Cloud Serverless database audit logging #20526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release-8.1
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,76 @@ | ||||||
--- | ||||||
title: TiDB Cloud Serverless Database Audit Logging | ||||||
summary: Learn about how to audit a serverless cluster in TiDB Cloud. | ||||||
--- | ||||||
|
||||||
# TiDB Cloud Serverless Database Audit Logging | ||||||
|
||||||
TiDB Cloud Serverless provides you with a database audit logging feature to record a history of user access details (such as any SQL statements executed) in logs. | ||||||
|
||||||
> **Note:** | ||||||
> | ||||||
> Currently, the database audit logging feature is only available upon request. To request this feature, click **?** in the lower-right corner of the [TiDB Cloud console](https://tidbcloud.com) and click **Request Support**. Then, fill in "Apply for TiDB Cloud Serverless database audit logging" in the **Description** field and click **Submit**. | ||||||
|
||||||
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. | ||||||
|
||||||
The audit logging feature is disabled by default. To audit a cluster, you need to enable the audit logging. | ||||||
|
||||||
## Enable audit logging | ||||||
|
||||||
To enable the audit logging for a TiDB Cloud Serverless cluster, using the [TiDB Cloud CLI](/tidb-cloud/cli-reference.md) | ||||||
|
||||||
```shell | ||||||
ticloud serverless audit-log enable --cluster-id <cluster-id> | ||||||
``` | ||||||
|
||||||
To disable the audit logging for a TiDB Cloud Serverless cluster, using the [TiDB Cloud CLI](/tidb-cloud/cli-reference.md) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a link to the specific CLI command documentation for
Suggested change
|
||||||
|
||||||
```shell | ||||||
ticloud serverless audit-log disable --cluster-id <cluster-id> | ||||||
``` | ||||||
|
||||||
## Configure audit logging | ||||||
|
||||||
### Redacted | ||||||
|
||||||
TiDB Cloud Serverless redacts sensitive data in the audit logs by default. For example, the following SQL statement: | ||||||
|
||||||
```sql | ||||||
INSERT INTO `test`.`users` (`id`, `name`, `password`) VALUES (1, 'Alice', '123456'); | ||||||
``` | ||||||
|
||||||
is redacted as follows: | ||||||
|
||||||
```sql | ||||||
INSERT INTO `test`.`users` (`id`, `name`, `password`) VALUES ( ... ); | ||||||
``` | ||||||
|
||||||
If you want to disable the redaction, using the [TiDB Cloud CLI](/tidb-cloud/cli-reference.md) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a link to the specific CLI command documentation for
Suggested change
|
||||||
|
||||||
```shell | ||||||
ticloud serverless audit-log config --cluster-id <cluster-id> --unredacted | ||||||
``` | ||||||
|
||||||
### Rotation | ||||||
|
||||||
TiDB Cloud Serverless will start to generate a new audit log file when one of the following conditions is met: | ||||||
|
||||||
- The audit log file reaches 100 MB. | ||||||
- The time interval reaches 1 hour. Note that the audit log files may not be generated exactly at the time interval of 1 hour, it may be delayed for a few minutes depending on the underlying schedule. | ||||||
|
||||||
## View audit logs | ||||||
|
||||||
TiDB Cloud Serverless audit logs are readable text files named `YYYY-MM-DD-<uuid>.log`. You can download the audit logs by [TiDB Cloud CLI](/tidb-cloud/cli-reference.md) to view them. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a link to the specific CLI command documentation for
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
|
||||||
```shell | ||||||
ticloud serverless audit-log download --cluster-id <cluster-id> --output-path <output-path> --start-day <start-day> --end-day <end-day> | ||||||
``` | ||||||
|
||||||
> **Note:** | ||||||
> TiDB Cloud only save your audit logs xx days. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
|
||||||
## Audit logging limitations | ||||||
|
||||||
- The audit logging is only available for TiDB Cloud CLI, the support of TiDB Cloud Console will be available soon. | ||||||
Check warning on line 74 in tidb-cloud/serverless-audit-logging.md
|
||||||
- The audit logging can only be generated in the TiDB Cloud, the support of external storage will be available soon. | ||||||
- TiDB Cloud Serverless does not guarantee the sequential order of the audit logs, which means you might have to review all log files to see the latest events. To order the logs, you can use the `TIME` field in the event records. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a link to the specific CLI command documentation for
ticloud serverless audit-log enable
for more detailed information.