diff --git a/TOC-tidb-cloud-essential.md b/TOC-tidb-cloud-essential.md index 83664bac8e801..d8312039de87e 100644 --- a/TOC-tidb-cloud-essential.md +++ b/TOC-tidb-cloud-essential.md @@ -266,6 +266,7 @@ - [TLS Connections to TiDB Cloud](/tidb-cloud/secure-connections-to-serverless-clusters.md) - Audit Management - [Console Audit Logging](/tidb-cloud/tidb-cloud-console-auditing.md) + - [Database Audit Logging](/tidb-cloud/serverless-database-audit-logging.md) - Billing - [Invoices](/tidb-cloud/tidb-cloud-billing.md#invoices) - [Billing Details](/tidb-cloud/tidb-cloud-billing.md#billing-details) @@ -605,6 +606,18 @@ - [delete](/tidb-cloud/ticloud-serverless-authorized-network-delete.md) - [list](/tidb-cloud/ticloud-serverless-authorized-network-list.md) - [update](/tidb-cloud/ticloud-serverless-authorized-network-update.md) + - audit-log + - config + - [update](/tidb-cloud/ticloud-serverless-audit-log-config-update.md) + - [describe](/tidb-cloud/ticloud-serverless-audit-log-config-describe.md) + - filter-rule + - [create](/tidb-cloud/ticloud-serverless-audit-log-filter-rule-create.md) + - [delete](/tidb-cloud/ticloud-serverless-audit-log-filter-rule-delete.md) + - [describe](/tidb-cloud/ticloud-serverless-audit-log-filter-rule-describe.md) + - [list](/tidb-cloud/ticloud-serverless-audit-log-filter-rule-list.md) + - [update](/tidb-cloud/ticloud-serverless-audit-log-filter-rule-update.md) + - [template](/tidb-cloud/ticloud-serverless-audit-log-filter-rule-template.md) + - [download](/tidb-cloud/ticloud-serverless-audit-log-download.md) - [ai](/tidb-cloud/ticloud-ai.md) - [completion](/tidb-cloud/ticloud-completion.md) - config diff --git a/tidb-cloud/serverless-audit-logging.md b/tidb-cloud/serverless-audit-logging.md deleted file mode 100644 index 5fb94cf7dabaf..0000000000000 --- a/tidb-cloud/serverless-audit-logging.md +++ /dev/null @@ -1,230 +0,0 @@ ---- -title: Database Audit Logging for {{{ .starter }}} and Essential -summary: Learn about how to audit a {{{ .starter }}} or {{{ .essential }}} cluster in TiDB Cloud. ---- - -# Database Audit Logging (Beta) for {{{ .starter }}} and Essential - -{{{ .starter }}} and {{{ .essential }}} provide 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 {{{ .starter }}} or {{{ .essential }}} 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 audit logging for it. - -## Enable audit logging - -To enable audit logging for a {{{ .starter }}} or {{{ .essential }}} cluster, use the [TiDB Cloud CLI](/tidb-cloud/ticloud-auditlog-config.md). - -```shell -ticloud serverless audit-log config -c --enabled -``` - -To disable audit logging for a {{{ .starter }}} or {{{ .essential }}} cluster, use the [TiDB Cloud CLI](/tidb-cloud/ticloud-auditlog-config.md). - -```shell -ticloud serverless audit-log config -c --enabled=false -``` - -> **Note:** -> -> Only enabling audit logging will not generate audit logs. You need to configure filters to specify what events to log. For more information, see [Manage audit logging filter rules](#manage-audit-logging-filter-rules). - -## Manage audit logging filter rules - -To filter the audit logging, you need to create a filter rule to specify which events to log. You can use the [TiDB Cloud CLI](/tidb-cloud/ticloud-auditlog-filter-create.md) to manage the filter rules. - -The filter rule contains the following fields: - -- `users`: A list of user names to filter audit events. You can use the wildcard `%` to match any user name. -- `filters`: A list of filter objects. Each filter object can contain the following fields: - - - `classes`: A list of event classes to filter audit events. For example, `["QUERY", "EXECUTE"]`. - - `tables`: A list of table filters. For more information, see [Table filters]. - - `statusCodes`: A list of status codes to filter audit events. `1` means success, `0` means failure. - -Here is the summary of all event classes in database audit logging: - -| Event Class | Description | Parent-class | -|---------------|--------------------------------------------------------------------------------------------------|---------------| -| CONNECTION | Record all operations related to connections, such as handshaking, connections, disconnections, connection reset, and changing users | - | -| CONNECT | Record all operations of the handshaking in connections | CONNECTION | -| DISCONNECT | Record all operations of the disconnections | CONNECTION | -| CHANGE_USER | Record all operations of changing users | CONNECTION | -| QUERY | Record all operations of SQL statements, including all errors about querying and modifying data | - | -| TRANSACTION | Record all operations related to transactions, such as `BEGIN`, `COMMIT`, and `ROLLBACK` | QUERY | -| EXECUTE | Record all operations of the `EXECUTE` statements | QUERY | -| QUERY_DML | Record all operations of the DML statements, including `INSERT`, `REPLACE`, `UPDATE`, `DELETE`, and `LOAD DATA` | QUERY | -| INSERT | Record all operations of the `INSERT` statements | QUERY_DML | -| REPLACE | Record all operations of the `REPLACE` statements | QUERY_DML | -| UPDATE | Record all operations of the `UPDATE` statements | QUERY_DML | -| DELETE | Record all operations of the `DELETE` statements | QUERY_DML | -| LOAD DATA | Record all operations of the `LOAD DATA` statements | QUERY_DML | -| SELECT | Record all operations of the `SELECT` statements | QUERY | -| QUERY_DDL | Record all operations of the DDL statements | QUERY | -| AUDIT | Record all operations related to setting TiDB database auditing, including setting system variables and calling system functions | - | -| AUDIT_FUNC_CALL | Record all operations of calling system functions related to TiDB database auditing | AUDIT | - -### Create a filter rule - -To create a filter rule that captures all audit logs, run the following command: - -```shell -ticloud serverless audit-log filter create --cluster-id --name --rule '{"users":["%@%"],"filters":[{}]}' -``` - -To create a filter rule that filters ALL EXECUTE events, run the following command: - -```shell -ticloud serverless audit-log filter create --cluster-id --name --rule '{"users":["%@%"],"filters":[{"classes":["EXECUTE"]]}' -``` - -### Update a filter rule - -To disable a filter rule, run the following command: - -```shell -ticloud serverless audit-log filter update --cluster-id --name --enabled=false -``` - -To update a filter rule, run the following command: - -```shell -ticloud serverless audit-log filter update --cluster-id --name --rule '{"users":["%@%"],"filters":[{"classes":["QUERY"],"tables":["test.t"]}]}' -``` - -Note that you need to pass the complete `--rule` field when updating. - -### Delete a filter rule - -To delete a filter rule, run the following command: - -```shell -ticloud serverless audit-log filter delete --cluster-id --name -``` - -## Configure audit logging - -### Data redaction - -{{{ .starter }}} and {{{ .essential }}} redact sensitive data in the audit logs by default. Take the following SQL statement as an example: - -```sql -INSERT INTO `test`.`users` (`id`, `name`, `password`) VALUES (1, 'Alice', '123456'); -``` - -It is redacted as follows: - -```sql -INSERT INTO `test`.`users` (`id`, `name`, `password`) VALUES ( ... ); -``` - -If you want to disable redaction, use the [TiDB Cloud CLI](/tidb-cloud/ticloud-auditlog-config.md). - -```shell -ticloud serverless audit-log config --cluster-id --unredacted -``` - -### Log file rotation - -{{{ .starter }}} and {{{ .essential }}} generate a new audit log file when either of the following conditions is met: - -- The size of the current log file reaches 100 MiB. -- One hour has passed since the previous log generation. Depending on the internal scheduling mechanism, log generation might be delayed by a few minutes. - -> **Note:** -> -> Currently, Log file rotation settings are not configurable. {{{ .starter }}} and {{{ .essential }}} automatically rotate the audit log files based on the preceding conditions. - -## Access audit logging - -{{{ .starter }}} and {{{ .essential }}} audit logs are stored as readable text files named `YYYY-MM-DD-.log`. - -Currently, audit logs are stored within TiDB Cloud for 365 days. After this period, logs are automatically deleted. - -> **Note:** -> -> Contact [TiDB Cloud Support](https://docs.pingcap.com/tidbcloud/tidb-cloud-support) if you need to save audit logs in external storage (such as Amazon S3, Azure Blob Storage, Google Cloud Storage, and Alibaba Cloud OSS). - -To view and download audit logs, use the [TiDB Cloud CLI](/tidb-cloud/ticloud-auditlog-download.md): - -```shell -ticloud serverless audit-log download --cluster-id --output-path --start-date --end-date -``` - -- `start-date`: The start date of the audit log you want to download in the format of `YYYY-MM-DD`, for example `2025-01-01`. -- `end-date`: The end date of the audit log you want to download in the format of `YYYY-MM-DD`, for example `2025-01-01`. - -> **Note:** -> -> {{{ .starter }}} and {{{ .essential }}} do not guarantee sequential ordering of audit logs. The log file named `YYYY-MM-DD-.log` might contain the audit logs in previous days. -> If you want to retrieve all logs from a specific date (for example, January 1, 2025), specifying `--start-date 2025-01-01` and `--end-date 2025-01-02` usually works. But under extreme conditions, you might need to download all log files and order them by the `TIME` field. - -## Audit logging fields - -For each database event record in audit logs, TiDB provides the following fields: - -### General information - -All classes of audit logs contain the following information: - -| Field | Description | -|---------------|-----------------------------------------------------------------------------------------------| -| ID | The unique identifier that identifies the audit record of an operation | -| TIME | The timestamp of the audit record | -| EVENT | The event classes of the audit record. Multiple event types are separated by commas (`,`) | -| USER | The username of the audit record | -| ROLES | The roles of the user at the time of the operation | -| CONNECTION_ID | The identifier of the user's connection | -| TABLES | The accessed tables related to this audit record | -| STATUS_CODE | The status code of the audit record. `1` means success, and `0` means failure. | -| KEYSPACE_NAME | The keyspace name of the audit record. | -| SERVERLESS_TENANT_ID | The ID of the serverless tenant that the cluster belongs to. | -| SERVERLESS_TSERVERLESS_PROJECT_ID | The ID of the serverless project that the cluster belongs to. | -| SERVERLESS_CLUSTER_ID | The ID of the serverless cluster that the audit record belongs to. | -| REASON | The error message of the audit record. Only recorded when an error occurs during the operation. | - -### SQL statement information - -When the event class is `QUERY` or a subclass of `QUERY`, the audit logs contain the following information: - -| Field | Description | -|----------------|---------------------------------------------------------------------------------------------------------------| -| CURRENT_DB | The name of the current database. | -| SQL_TEXT | The executed SQL statements. If audit log redaction is enabled, the redacted SQL statements are recorded. | -| EXECUTE_PARAMS | The parameters for the `EXECUTE` statements. Recorded only when the event classes include `EXECUTE` and redaction is disabled. | -| AFFECTED_ROWS | The number of affected rows of the SQL statements. Recorded only when the event classes include `QUERY_DML`. | - -### Connection information - -When the event class is `CONNECTION` or a subclass of `CONNECTION`, the audit logs contain the following information: - -| Field | Description | -|-----------------|-----------------------------------------------------------------------------------------------| -| CURRENT_DB | The name of the current database. When the event classes include DISCONNECT, this information is not recorded. | -| CONNECTION_TYPE | The type of connection, including Socket, UnixSocket, and SSL/TLS. | -| PID | The process ID of the current connection. | -| SERVER_VERSION | The current version of the connected TiDB server. | -| SSL_VERSION | The current version of SSL in use. | -| HOST_IP | The current IP address of the connected TiDB server. | -| HOST_PORT | The current port of the connected TiDB server. | -| CLIENT_IP | The current IP address of the client. | -| CLIENT_PORT | The current port of the client. | - -### Audit operation information - -When the event class is `AUDIT` or a subclass of `AUDIT`, the audit logs contain the following information: - -| Field | Description | -|----------------|---------------------------------------------------------------------------------------------------------------| -| AUDIT_OP_TARGET| The objects of the setting related to TiDB database auditing. | -| AUDIT_OP_ARGS | The arguments of the setting related to TiDB database auditing. | - -## Audit logging limitations - -- Audit logging is only available via TiDB Cloud CLI at present. -- Audit logs can only be stored in TiDB Cloud at present. -- {{{ .starter }}} and {{{ .essential }}} do not guarantee the sequential order of audit logs, which means you might have to review all log files to view the latest events. To sort the logs chronologically, you can use the `TIME` field in the audit logs. diff --git a/tidb-cloud/serverless-database-audit-logging.md b/tidb-cloud/serverless-database-audit-logging.md new file mode 100644 index 0000000000000..3476fc5f54270 --- /dev/null +++ b/tidb-cloud/serverless-database-audit-logging.md @@ -0,0 +1,445 @@ +--- +title: Database Audit Logging for {{{ .essential }}} +summary: Learn about how to audit a {{{ .essential }}} cluster in TiDB Cloud. +aliases: ['/tidbcloud/serverless-audit-logging'] +--- + +# Database Audit Logging (Beta) for {{{ .essential }}} + +{{{ .essential }}} provide 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 {{{ .essential }}} 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 audit logging for it. + +## Audit logging configurations + +### Data redaction + +{{{ .essential }}} redact sensitive data in the audit logs by default. Take the following SQL statement as an example: + +```sql +INSERT INTO `test`.`users` (`id`, `name`, `password`) VALUES (1, 'Alice', '123456'); +``` + +It is redacted as follows: + +```sql +INSERT INTO `test`.`users` (`id`, `name`, `password`) VALUES ( ... ); +``` + +### Log file rotation + +{{{ .essential }}} generate a new audit log file when either of the following conditions is met: + +- The size of the current log file reaches rotation size (100 MB by default). +- Rotation interval (one hour by default) has passed since the previous log generation. Depending on the internal scheduling mechanism, log generation might be delayed by a few minutes. + +## Audit logging locations + +You can store the audit logs to the following locations: + +- TiDB Cloud +- [Amazon S3](https://aws.amazon.com/s3/) +- [Google Cloud Storage](https://cloud.google.com/storage) +- [Azure Blob Storage](https://azure.microsoft.com/en-us/services/storage/blobs/) +- [Alibaba Cloud Object Storage Service (OSS)](https://www.alibabacloud.com/product/oss) + +### TiDB Cloud + +You can store audit logs in TiDB Cloud and download them to your local machine. The audit logs will be expired and deleted after 365 days. To request longer storage duration, contact [TiDB Cloud Support](/tidb-cloud/tidb-cloud-support.md). + +### Amazon S3 + +To store audit logs to Amazon S3, you need to provide the following information: + +- URI: `s3:////` +- One of the following access credentials: + - [An access key](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html): make sure the access key has the `s3:PutObject` and `s3:ListBucket` permissions. + - [A role ARN](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html): make sure the role ARN (Amazon Resource Name) has the `s3:PutObject` permissions. Note that only clusters hosted on AWS support the role ARN. + +For more information, see [Configure Amazon S3 access](/tidb-cloud/serverless-external-storage.md#configure-amazon-s3-access). + +### Google Cloud Storage + +To store audit logs to Google Cloud Storage, you need to provide the following information: + +- URI: `gs:////` +- Access credential: a **base64 encoded** [service account key](https://cloud.google.com/iam/docs/creating-managing-service-account-keys) for your bucket. Make sure the service account key has the `storage.objects.create` and `storage.objects.delete` permissions. + +For more information, see [Configure GCS access](/tidb-cloud/serverless-external-storage.md#configure-gcs-access). + +### Azure Blob Storage + +To store audit logs to Azure Blob Storage, you need to provide the following information: + +- URI: `azure://.blob.core.windows.net///` or `https://.blob.core.windows.net///` +- Access credential: a [shared access signature (SAS) token](https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview) for your Azure Blob Storage container. Make sure the SAS token has the `Read` and `Write` permissions on the `Container` and `Object` resources. + +For more information, see [Configure Azure Blob Storage access](/tidb-cloud/serverless-external-storage.md#configure-azure-blob-storage-access). + +### Alibaba Cloud OSS + +To store audit logs to Alibaba Cloud OSS, you need to provide the following information: + +- URI: `oss:////` +- Access credential: An [AccessKey pair](https://www.alibabacloud.com/help/en/ram/user-guide/create-an-accesskey-pair) for your Alibaba Cloud account. Make sure the AccessKey pair has the `oss:PutObject` and `oss:GetBucketInfo` permissions to allow data export to the OSS bucket. + +For more information, see [Configure Alibaba Cloud Object Storage Service (OSS) access](/tidb-cloud/serverless-external-storage.md#configure-alibaba-cloud-object-storage-service-oss-access). + +## Audit logging filter rules + +To filter the audit logging, you need to create a filter rule to specify which events to log. + +The filter rule contains the following fields: + +- `users`: A list of user names to filter audit events. You can use the wildcard `%` to match any user name. +- `filters`: A list of filter objects. Each filter object can contain the following fields: + + - `classes`: A list of event classes to filter audit events. For example, `["QUERY", "EXECUTE"]`. + - `tables`: A list of table filters. For more information, see [Table filters]. + - `statusCodes`: A list of status codes to filter audit events. `1` means success, `0` means failure. + +Here is the summary of all event classes in database audit logging: + +| Event Class | Description | Parent-class | +|---------------|--------------------------------------------------------------------------------------------------|---------------| +| CONNECTION | Record all operations related to connections, such as handshaking, connections, disconnections, connection reset, and changing users | - | +| CONNECT | Record all operations of the handshaking in connections | CONNECTION | +| DISCONNECT | Record all operations of the disconnections | CONNECTION | +| CHANGE_USER | Record all operations of changing users | CONNECTION | +| QUERY | Record all operations of SQL statements, including all errors about querying and modifying data | - | +| TRANSACTION | Record all operations related to transactions, such as `BEGIN`, `COMMIT`, and `ROLLBACK` | QUERY | +| EXECUTE | Record all operations of the `EXECUTE` statements | QUERY | +| QUERY_DML | Record all operations of the DML statements, including `INSERT`, `REPLACE`, `UPDATE`, `DELETE`, and `LOAD DATA` | QUERY | +| INSERT | Record all operations of the `INSERT` statements | QUERY_DML | +| REPLACE | Record all operations of the `REPLACE` statements | QUERY_DML | +| UPDATE | Record all operations of the `UPDATE` statements | QUERY_DML | +| DELETE | Record all operations of the `DELETE` statements | QUERY_DML | +| LOAD DATA | Record all operations of the `LOAD DATA` statements | QUERY_DML | +| SELECT | Record all operations of the `SELECT` statements | QUERY | +| QUERY_DDL | Record all operations of the DDL statements | QUERY | +| AUDIT | Record all operations related to setting TiDB database auditing, including setting system variables and calling system functions | - | +| AUDIT_FUNC_CALL | Record all operations of calling system functions related to TiDB database auditing | AUDIT | + +## Configure audit logging + +### Enable audit logging + +You can enable audit logging for a {{{ .essential }}} cluster. + +> **Note:** +> +> Only enabling audit logging will not generate audit logs. You need to configure filters to specify what events to log. For more information, see [Manage audit logging filter rules](#manage-audit-logging-filter-rules). + + +
+ +1. Log in to the [TiDB Cloud console](https://tidbcloud.com/) and navigate to the [**Clusters**](https://tidbcloud.com/project/clusters) page of your project. + + > **Tip:** + > + > You can use the combo box in the upper-left corner to switch between organizations, projects, and clusters. + +2. Click the name of your target cluster to go to its overview page, and then click **Settings** > **DB Audit Logging** in the left navigation pane. + +3. On the **DB Audit Logging** page, click **Enable**. + +4. Select the storage location of the audit logs and fill in the necessary information, then click **Test Connection and Next** or **Next**. For more information about the available storage locations, see [Audit logging locations](#audit-logging-locations). + +5. In the **Database Audit Logging Setting** pop-up, fill the log file rotation and log redaction settings, and then click **Save**. + +
+ +
+ +Take s3 storage as an example. Run the following command to enable audit logging and store the audit logs to Amazon S3: + +```shell +ticloud serverless audit-log config update -c --enabled --cloud-storage S3 --s3.uri --s3.access-key-id --s3.secret-access-key --rotation-size-mib --rotation-interval-minutes --unredacted= +``` + +`--rotation-size-mib`, `--rotation-interval-minutes`, and `--unredacted` are optional parameters. If you do not specify them, the default values are used. + +
+
+ +### Edit audit logging + +You can Edit the audit logging for a {{{ .essential }}} cluster after enabling it. + + +
+ +1. Log in to the [TiDB Cloud console](https://tidbcloud.com/) and navigate to the [**Clusters**](https://tidbcloud.com/project/clusters) page of your project. + + > **Tip:** + > + > You can use the combo box in the upper-left corner to switch between organizations, projects, and clusters. + +2. Click the name of your target cluster to go to its overview page, and then click **Settings** > **DB Audit Logging** in the left navigation pane. + +3. On the **DB Audit Logging** page, click **Settings**. + +4. In the **Database Audit Logging Setting** pop-up, fill the log file rotation and log redaction settings, and then click **Save**. + +
+ +
+ +```shell +ticloud serverless audit-log config update -c --rotation-size-mib --rotation-interval-minutes --unredacted= +``` + +
+
+ +### Disable audit logging + +You can disable audit logging for a {{{ .essential }}} cluster. + + +
+ +1. Log in to the [TiDB Cloud console](https://tidbcloud.com/) and navigate to the [**Clusters**](https://tidbcloud.com/project/clusters) page of your project. + + > **Tip:** + > + > You can use the combo box in the upper-left corner to switch between organizations, projects, and clusters. + +2. Click the name of your target cluster to go to its overview page, and then click **Settings** > **DB Audit Logging** in the left navigation pane. + +3. On the **DB Audit Logging** page, click **...** in the upper-right corner, and then click **Disable**. + +4. Click **Disable** in the pop-up dialog to disable audit logging. + +
+ +
+ +```shell +ticloud serverless audit-log config update -c --disabled=true +``` + +
+
+ +## Manage audit logging filter rules + +### Create a filter rule + + +
+ +1. Log in to the [TiDB Cloud console](https://tidbcloud.com/) and navigate to the [**Clusters**](https://tidbcloud.com/project/clusters) page of your project. + + > **Tip:** + > + > You can use the combo box in the upper-left corner to switch between organizations, projects, and clusters. + +2. Click the name of your target cluster to go to its overview page, and then click **Settings** > **DB Audit Logging** in the left navigation pane. + +3. On the **DB Audit Logging** page, click **Add Filter Rule**. + +4. Fill in the `Filter Name`, `SQL Users`, and `Filter Rules` fields in the **Add Filter Rule** pop-up dialog, and then click **Confirm**. For more information about the fields, see [Audit logging filter rules](#audit-logging-filter-rules). + +
+ +
+ +```shell +ticloud serverless audit-log filter create --cluster-id --display-name --rule '{"users":["%@%"],"filters":[{}]}' +``` + +
+
+ +### Edit a filter rule + + +
+ +1. Log in to the [TiDB Cloud console](https://tidbcloud.com/) and navigate to the [**Clusters**](https://tidbcloud.com/project/clusters) page of your project. + + > **Tip:** + > + > You can use the combo box in the upper-left corner to switch between organizations, projects, and clusters. + +2. Click the name of your target cluster to go to its overview page, and then click **Settings** > **DB Audit Logging** in the left navigation pane. + +3. On the **DB Audit Logging** page, find the filter rule you want to edit, click **...** in its row, and then click **Edit**. + +4. Fill in the `Filter Name` and `Filter Rules` fields in the **Edit Filter Rule** pop-up dialog, and then click **Confirm**. + +
+ +
+ +```shell +ticloud serverless audit-log filter update --cluster-id --filter-rule-id --rule '{"users":["%@%"],"filters":[{"classes":["QUERY"],"tables":["test.t"]}]}' +``` + +
+
+ +### Disable a filter rule + + +
+ +1. Log in to the [TiDB Cloud console](https://tidbcloud.com/) and navigate to the [**Clusters**](https://tidbcloud.com/project/clusters) page of your project. + + > **Tip:** + > + > You can use the combo box in the upper-left corner to switch between organizations, projects, and clusters. + +2. Click the name of your target cluster to go to its overview page, and then click **Settings** > **DB Audit Logging** in the left navigation pane. + +3. On the **DB Audit Logging** page, choose the filter rule you want to disable. + +4. switch the slider to disable the filter rule. + +
+ +
+ +```shell +ticloud serverless audit-log filter update --cluster-id --filter-rule-id --enabled=false +``` + +
+
+ +### Delete a filter rule + + +
+ +1. Log in to the [TiDB Cloud console](https://tidbcloud.com/) and navigate to the [**Clusters**](https://tidbcloud.com/project/clusters) page of your project. + + > **Tip:** + > + > You can use the combo box in the upper-left corner to switch between organizations, projects, and clusters. + +2. Click the name of your target cluster to go to its overview page, and then click **Settings** > **DB Audit Logging** in the left navigation pane. + +3. On the **DB Audit Logging** page, choose the filter rule you want to delete and click **...**. + +4. Click **Delete** and then click **I understand. Delete it** in the pop-up dialog to delete the filter rule. + +
+ +
+ +```shell +ticloud serverless audit-log filter delete --cluster-id --filter-rule-id +``` + +
+
+ +## Access audit logging with TiDB Cloud Storage + +{{{ .essential }}} audit logs are stored as readable text files named `YYYY-MM-DD-.log`. When you store audit logs in TiDB Cloud, you can access and download them. + +> **Note:** +> +> {{{ .essential }}} do not guarantee sequential ordering of audit logs. The log file named `YYYY-MM-DD-.log` might contain the audit logs in previous days. +> If you want to retrieve all logs from a specific date (for example, January 1, 2025), specifying `--start-date 2025-01-01` and `--end-date 2025-01-02` usually works. But under extreme conditions, you might need to download all log files and order them by the `TIME` field. + + +
+ +1. Log in to the [TiDB Cloud console](https://tidbcloud.com/) and navigate to the [**Clusters**](https://tidbcloud.com/project/clusters) page of your project. + + > **Tip:** + > + > You can use the combo box in the upper-left corner to switch between organizations, projects, and clusters. + +2. Click the name of your target cluster to go to its overview page, and then click **Settings** > **DB Audit Logging** in the left navigation pane. + +3. On the **DB Audit Logging** page, you can view the list of audit logs under `TiDB Cloud Storage`. + +4. To download audit logs, select one or more logs from the list and then click **Download**. + +
+ +
+ +```shell +ticloud serverless audit-log download --cluster-id --output-path --start-date --end-date +``` + +- `start-date`: The start date of the audit log you want to download in the format of `YYYY-MM-DD`, for example `2025-01-01`. +- `end-date`: The end date of the audit log you want to download in the format of `YYYY-MM-DD`, for example `2025-01-01`. + +
+
+ +## Audit logging fields + +For each database event record in audit logs, TiDB provides the following fields: + +### General information + +All classes of audit logs contain the following information: + +| Field | Description | +|---------------|-----------------------------------------------------------------------------------------------| +| ID | The unique identifier that identifies the audit record of an operation | +| TIME | The timestamp of the audit record | +| EVENT | The event classes of the audit record. Multiple event types are separated by commas (`,`) | +| USER | The username of the audit record | +| ROLES | The roles of the user at the time of the operation | +| CONNECTION_ID | The identifier of the user's connection | +| TABLES | The accessed tables related to this audit record | +| STATUS_CODE | The status code of the audit record. `1` means success, and `0` means failure. | +| KEYSPACE_NAME | The keyspace name of the audit record. | +| SERVERLESS_TENANT_ID | The ID of the serverless tenant that the cluster belongs to. | +| SERVERLESS_TSERVERLESS_PROJECT_ID | The ID of the serverless project that the cluster belongs to. | +| SERVERLESS_CLUSTER_ID | The ID of the serverless cluster that the audit record belongs to. | +| REASON | The error message of the audit record. Only recorded when an error occurs during the operation. | + +### SQL statement information + +When the event class is `QUERY` or a subclass of `QUERY`, the audit logs contain the following information: + +| Field | Description | +|----------------|---------------------------------------------------------------------------------------------------------------| +| CURRENT_DB | The name of the current database. | +| SQL_TEXT | The executed SQL statements. If audit log redaction is enabled, the redacted SQL statements are recorded. | +| EXECUTE_PARAMS | The parameters for the `EXECUTE` statements. Recorded only when the event classes include `EXECUTE` and redaction is disabled. | +| AFFECTED_ROWS | The number of affected rows of the SQL statements. Recorded only when the event classes include `QUERY_DML`. | + +### Connection information + +When the event class is `CONNECTION` or a subclass of `CONNECTION`, the audit logs contain the following information: + +| Field | Description | +|-----------------|-----------------------------------------------------------------------------------------------| +| CURRENT_DB | The name of the current database. When the event classes include DISCONNECT, this information is not recorded. | +| CONNECTION_TYPE | The type of connection, including Socket, UnixSocket, and SSL/TLS. | +| PID | The process ID of the current connection. | +| SERVER_VERSION | The current version of the connected TiDB server. | +| SSL_VERSION | The current version of SSL in use. | +| HOST_IP | The current IP address of the connected TiDB server. | +| HOST_PORT | The current port of the connected TiDB server. | +| CLIENT_IP | The current IP address of the client. | +| CLIENT_PORT | The current port of the client. | + +### Audit operation information + +When the event class is `AUDIT` or a subclass of `AUDIT`, the audit logs contain the following information: + +| Field | Description | +|----------------|---------------------------------------------------------------------------------------------------------------| +| AUDIT_OP_TARGET| The objects of the setting related to TiDB database auditing. | +| AUDIT_OP_ARGS | The arguments of the setting related to TiDB database auditing. | + +## Audit logging limitations + +- Do not guarantee the sequential order of audit logs, which means you might have to review all log files to view the latest events. To sort the logs chronologically, you can use the `TIME` field in the audit logs. diff --git a/tidb-cloud/ticloud-auditlog-config.md b/tidb-cloud/ticloud-auditlog-config.md deleted file mode 100644 index 2b2c88d0abd80..0000000000000 --- a/tidb-cloud/ticloud-auditlog-config.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: ticloud serverless audit-log config -summary: The reference of `ticloud serverless audit-log config`. ---- - -# ticloud serverless audit-log config - -Configure the database audit logging for a {{{ .starter }}} or {{{ .essential }}} cluster. - -```shell -ticloud serverless audit-log config [flags] -``` - -## Examples - -Configure the database audit logging in interactive mode: - -```shell -ticloud serverless audit-log config -``` - -Enable the database audit logging in non-interactive mode: - -```shell -ticloud serverless audit-log config -c --enabled -``` - -Disable the database audit logging in non-interactive mode: - -```shell -ticloud serverless audit-log config -c --enabled=false -``` - -Unredact the database audit logging in non-interactive mode: - -```shell -ticloud serverless audit-log config -c --unredacted -``` - -## Flags - -In non-interactive mode, you need to manually enter the required flags. In interactive mode, you can just follow CLI prompts to fill them in. - -| Flag | Description | Required | Note | -|-------------------------|-----------------------------------------------------------------------------|----------|------------------------------------------------------| -| -c, --cluster-id string | The ID of the cluster. | Yes | Only works in non-interactive mode. | -| --enabled | Enable or disable the database audit logging. | No | Only works in non-interactive mode. | -| --unredacted | Enable or disable data redaction in audit logs. | No | Only works in non-interactive mode. | -| -h, --help | Shows help information for this command. | No | Works in both non-interactive and interactive modes. | - -## Inherited flags - -| Flag | Description | Required | Note | -|----------------------|------------------------------------------------------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------| -| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. | -| -P, --profile string | Specifies the active [user profile](/tidb-cloud/cli-reference.md#user-profile) used in this command. | No | Works in both non-interactive and interactive modes. | -| -D, --debug | Enables debug mode. | No | Works in both non-interactive and interactive modes. | - -## Feedback - -If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an [issue](https://github.com/tidbcloud/tidbcloud-cli/issues/new/choose). Also, we welcome any contributions. diff --git a/tidb-cloud/ticloud-auditlog-download.md b/tidb-cloud/ticloud-auditlog-download.md deleted file mode 100644 index 9ac6a5f522938..0000000000000 --- a/tidb-cloud/ticloud-auditlog-download.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: ticloud serverless audit-log download -summary: The reference of `ticloud serverless audit-log download`. ---- - -# ticloud serverless audit-log download - -Download the database audit logs from a {{{ .starter }}} or {{{ .essential }}} cluster. - -```shell -ticloud serverless audit-log download [flags] -``` - -## Examples - -Download the database audit logs in interactive mode: - -```shell -ticloud serverless audit-log download -``` - -Download the database audit logs in non-interactive mode: - -```shell -ticloud serverless audit-log download -c --start-date --end-date -``` - -## Flags - -In non-interactive mode, you need to manually enter the required flags. In interactive mode, you can just follow CLI prompts to fill them in. - -| Flag | Description | Required | Note | -|-------------------------|---------------------------------------------------------------------------------------------------------------------|----------|------------------------------------------------------| -| -c, --cluster-id string | Cluster ID. | Yes | Only works in non-interactive mode. | -| --start-date string | The start date of the audit log you want to download in the format of `YYYY-MM-DD`, for example `2025-01-01`. | Yes | Only works in non-interactive mode. | -| --end-date string | The end date of the audit log you want to download in the format of `YYYY-MM-DD`, for example `2025-01-01`. | Yes | Only works in non-interactive mode. | -| --output-path string | The path where you want to download the audit logs. If not specified, logs are downloaded to the current directory. | No | Only works in non-interactive mode. | -| --concurrency int | Download concurrency (`3` by default). | No | Works in both non-interactive and interactive modes. | -| --force | Download without confirmation. | No | Works in both non-interactive and interactive modes. | -| -h, --help | Shows help information for this command. | No | Works in both non-interactive and interactive modes. | - -## Inherited flags - -| Flag | Description | Required | Note | -|----------------------|------------------------------------------------------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------| -| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. | -| -P, --profile string | Specifies the active [user profile](/tidb-cloud/cli-reference.md#user-profile) used in this command. | No | Works in both non-interactive and interactive modes. | -| -D, --debug | Enables debug mode. | No | Works in both non-interactive and interactive modes. | - -## Feedback - -If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an [issue](https://github.com/tidbcloud/tidbcloud-cli/issues/new/choose). Also, we welcome any contributions. diff --git a/tidb-cloud/ticloud-auditlog-describe.md b/tidb-cloud/ticloud-serverless-audit-log-config-describe.md similarity index 59% rename from tidb-cloud/ticloud-auditlog-describe.md rename to tidb-cloud/ticloud-serverless-audit-log-config-describe.md index 34fed7e537a89..98aabe3ed0636 100644 --- a/tidb-cloud/ticloud-auditlog-describe.md +++ b/tidb-cloud/ticloud-serverless-audit-log-config-describe.md @@ -1,20 +1,14 @@ --- -title: ticloud serverless audit-log describe -summary: The reference of `ticloud serverless audit-log describe`. +title: ticloud serverless audit-log config describe +summary: The reference of `ticloud serverless audit-log config describe`. --- -# ticloud serverless audit-log describe +# ticloud serverless audit-log config describe -Describe the database audit logging configuration for a {{{ .starter }}} or {{{ .essential }}} cluster. +Describe the database audit logging configuration for a TiDB Cloud Essential cluster. ```shell -ticloud serverless audit-log describe [flags] -``` - -Or use the following alias command: - -```shell -ticloud serverless audit-log get [flags] +ticloud serverless audit-log config describe [flags] ``` ## Examples @@ -22,31 +16,30 @@ ticloud serverless audit-log get [flags] Get the database audit logging configuration in interactive mode: ```shell -ticloud serverless audit-log describe +ticloud serverless audit-log config describe ``` Get the database audit logging configuration in non-interactive mode: ```shell -ticloud serverless audit-log describe -c +ticloud serverless audit-log config describe -c ``` ## Flags -In non-interactive mode, you need to manually enter the required flags. In interactive mode, you can just follow CLI prompts to fill them in. - | Flag | Description | Required | Note | |-------------------------|----------------------------|----------|------------------------------------------------------| | -c, --cluster-id string | The cluster ID. | Yes | Only works in non-interactive mode. | -| -h, --help | Shows help information for this command. | No | Works in both non-interactive and interactive modes. | +| -h, --help | Shows help information for this command. | No | Works in both interactive and non-interactive modes. | ## Inherited flags | Flag | Description | Required | Note | |----------------------|------------------------------------------------------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------| -| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. | -| -D, --debug | Enables debug mode. | No | Works in both non-interactive and interactive modes. | +| -D, --debug | Enable debug mode. | No | Works in both interactive and non-interactive modes. | +| --no-color | Disable color output. | No | Only works in non-interactive mode. | +| -P, --profile string | Profile to use from your configuration file. | No | Works in both interactive and non-interactive modes. | ## Feedback -If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an [issue](https://github.com/tidbcloud/tidbcloud-cli/issues/new/choose). Also, we welcome any contributions. \ No newline at end of file +If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an [issue](https://github.com/tidbcloud/tidbcloud-cli/issues/new/choose). Also, we welcome any contributions. diff --git a/tidb-cloud/ticloud-serverless-audit-log-config-update.md b/tidb-cloud/ticloud-serverless-audit-log-config-update.md new file mode 100644 index 0000000000000..e1d3061e9509d --- /dev/null +++ b/tidb-cloud/ticloud-serverless-audit-log-config-update.md @@ -0,0 +1,79 @@ +--- +title: ticloud serverless audit-log config update +summary: The reference of `ticloud serverless audit-log config update`. +--- + +# ticloud serverless audit-log config update + +Update the database audit logging configuration for a TiDB Cloud Essential cluster. + +```shell +ticloud serverless audit-log config update [flags] +``` + +## Examples + +Configure database audit logging in interactive mode: + +```shell +ticloud serverless audit-log config update +``` + +Unredact the database audit log in non-interactive mode: + +```shell +ticloud serverless audit-log config update -c --unredacted +``` + +Enable database audit logging with S3 Cloud Storage in non-interactive mode: + +```shell +ticloud serverless audit-log config update -c --enabled --cloud-storage S3 --s3.uri --s3.access-key-id --s3.secret-access-key +``` + +Configure database audit logging rotation strategy in non-interactive mode: + +```shell +ticloud serverless audit-log config update -c --rotation-interval-minutes --rotation-size-mib +``` + +Disable database audit logging in non-interactive mode: + +```shell +ticloud serverless audit-log config update -c --enabled=false +``` + +## Flags + +| Flag | Description | Required | Note | +|------|-------------|----------|------| +| --azblob.sas-token string | The SAS token of Azure Blob. | No | Only works in non-interactive mode. | +| --azblob.uri string | The Azure Blob URI in `azure://.blob.core.windows.net//` format. | No | Only works in non-interactive mode. | +| --cloud-storage string | The cloud storage. One of ["TIDB_CLOUD", "S3", "GCS", "AZURE_BLOB", "OSS"]. | No | Only works in non-interactive mode. | +| -c, --cluster-id string | The ID of the cluster to be updated. | Yes | Only works in non-interactive mode. | +| --enabled | Enable or disable database audit logging. | No | Only works in non-interactive mode. | +| --gcs.service-account-key string | The base64 encoded service account key of GCS. | No | Only works in non-interactive mode. | +| --gcs.uri string | The GCS URI in `gs:///` format. | No | Only works in non-interactive mode. | +| --oss.access-key-id string | The access key ID of the OSS. | No | Only works in non-interactive mode. | +| --oss.access-key-secret string | The access key secret of the OSS. | No | Only works in non-interactive mode. | +| --oss.uri string | The OSS URI in `oss:///` format. | No | Only works in non-interactive mode. | +| --rotation-interval-minutes int32 | The rotation interval in minutes, range [10, 1440]. | No | Only works in non-interactive mode. | +| --rotation-size-mib int32 | The rotation size in MiB, range [1, 1024]. | No | Only works in non-interactive mode. | +| --s3.access-key-id string | The access key ID of the S3. You only need to set one of the s3.role-arn and [s3.access-key-id, s3.secret-access-key]. | No | Only works in non-interactive mode. | +| --s3.role-arn string | The role arn of the S3. You only need to set one of the s3.role-arn and [s3.access-key-id, s3.secret-access-key]. | No | Only works in non-interactive mode. | +| --s3.secret-access-key string | The secret access key of the S3. You only need to set one of the s3.role-arn and [s3.access-key-id, s3.secret-access-key]. | No | Only works in non-interactive mode. | +| --s3.uri string | The S3 URI in `s3:///` format. | No | Only works in non-interactive mode. | +| --unredacted | Unredact or redact the database audit log. | No | Only works in non-interactive mode. | +| -h, --help | Shows help information for this command. | No | Works in both interactive and non-interactive modes. | + +## Inherited flags + +| Flag | Description | Required | Note | +|------|-------------|----------|------| +| -D, --debug | Enable debug mode. | No | Works in both interactive and non-interactive modes. | +| --no-color | Disable color output. | No | Only works in non-interactive mode. | +| -P, --profile string | Profile to use from your configuration file. | No | Works in both interactive and non-interactive modes. | + +## Feedback + +If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an [issue](https://github.com/tidbcloud/tidbcloud-cli/issues/new/choose). Also, we welcome any \ No newline at end of file diff --git a/tidb-cloud/ticloud-serverless-audit-log-download.md b/tidb-cloud/ticloud-serverless-audit-log-download.md new file mode 100644 index 0000000000000..18d5360d40621 --- /dev/null +++ b/tidb-cloud/ticloud-serverless-audit-log-download.md @@ -0,0 +1,50 @@ +--- +title: ticloud serverless audit-log download +summary: The reference of `ticloud serverless audit-log download`. +--- + +# ticloud serverless audit-log download + +Download the database audit log files from a TiDB Cloud Essential cluster. + +```shell +ticloud serverless audit-log download [flags] +``` + +## Examples + +Download the database audit logs in interactive mode: + +```shell +ticloud serverless audit-log download +``` + +Download the database audit logs in non-interactive mode: + +```shell +ticloud serverless audit-log download -c --start-date --end-date +``` + +## Flags + +| Flag | Description | Required | Note | +|-------------------------|-----------------------------------------------------------------------------------------------|----------|------------------------------------------------------| +| -c, --cluster-id string | Cluster ID. | Yes | Only works in non-interactive mode. | +| --start-date string | The start date of the audit log you want to download in the format of 'YYYY-MM-DD', e.g. '2025-01-01'. | Yes | Only works in non-interactive mode. | +| --end-date string | The end date of the audit log you want to download in the format of 'YYYY-MM-DD', e.g. '2025-01-01'. | Yes | Only works in non-interactive mode. | +| --output-path string | The path where you want to download to. If not specified, download to the current directory. | No | Only works in non-interactive mode. | +| --concurrency int | Download concurrency. (default 3) | No | Works in both interactive and non-interactive modes. | +| --force | Download without confirmation. | No | Works in both interactive and non-interactive modes. | +| -h, --help | Shows help information for this command. | No | Works in both interactive and non-interactive modes. | + +## Inherited flags + +| Flag | Description | Required | Note | +|----------------------|------------------------------------------------------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------| +| -D, --debug | Enable debug mode. | No | Works in both interactive and non-interactive modes. | +| --no-color | Disable color output. | No | Only works in non-interactive mode. | +| -P, --profile string | Profile to use from your configuration file. | No | Works in both interactive and non-interactive modes. | + +## Feedback + +If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an [issue](https://github.com/tidbcloud/tidbcloud-cli/issues/new/choose). Also, we welcome any contributions. diff --git a/tidb-cloud/ticloud-auditlog-filter-create.md b/tidb-cloud/ticloud-serverless-audit-log-filter-rule-create.md similarity index 58% rename from tidb-cloud/ticloud-auditlog-filter-create.md rename to tidb-cloud/ticloud-serverless-audit-log-filter-rule-create.md index f52e858b1a8c0..72ab87c159a7b 100644 --- a/tidb-cloud/ticloud-auditlog-filter-create.md +++ b/tidb-cloud/ticloud-serverless-audit-log-filter-rule-create.md @@ -5,56 +5,48 @@ summary: The reference of `ticloud serverless audit-log filter-rule create`. # ticloud serverless audit-log filter-rule create -Create an audit log filter rule for a {{{ .starter }}} or {{{ .essential }}} cluster. +Create an audit log filter rule for a TiDB Cloud Essential cluster. ```shell ticloud serverless audit-log filter-rule create [flags] ``` -Or use the following alias command: - -```shell -ticloud serverless audit-log filter create [flags] -``` - ## Examples Create a filter rule in interactive mode: ```shell -ticloud serverless audit-log filter create +ticloud serverless audit-log filter-rule create ``` -Create a filter rule that captures all audit logs in non-interactive mode: +Create a filter rule which filters all audit logs in non-interactive mode: ```shell -ticloud serverless audit-log filter create --cluster-id --name --rule '{"users":["%@%"],"filters":[{}]}' +ticloud serverless audit-log filter-rule create --cluster-id --display-name --rule '{"users":["%@%"],"filters":[{}]}' ``` -Create a filter rule that filters `QUERY` and `EXECUTE` events for the `test.t` table and filters `QUERY` events for all tables in non-interactive mode: +Create a filter rule which filters QUERY and EXECUTE for `test.t` and filters QUERY for all tables in non-interactive mode: ```shell -ticloud serverless audit-log filter create --cluster-id --name --rule '{"users":["%@%"],"filters":[{"classes":["QUERY","EXECUTE"],"tables":["test.t"]},{"classes":["QUERY"]}]}' +ticloud serverless audit-log filter-rule create --cluster-id --display-name --rule '{"users":["%@%"],"filters":[{"classes":["QUERY","EXECUTE"],"tables":["test.t"]},{"classes":["QUERY"]}]}' ``` ## Flags -In non-interactive mode, you need to manually enter the required flags. In interactive mode, you can just follow CLI prompts to fill them in. - | Flag | Description | Required | Note | |-------------------------|-------------------------------------------------------------------------------------------------------------|----------|------------------------------------------------------| | -c, --cluster-id string | The ID of the cluster. | Yes | Only works in non-interactive mode. | -| --name string | The name of the filter rule. | Yes | Only works in non-interactive mode. | -| --rule string | Filter rule expressions. Use `ticloud serverless audit-log filter template` to see filter templates. | Yes | Only works in non-interactive mode. | -| -h, --help | Shows help information for this command. | No | Works in both non-interactive and interactive modes. | +| --display-name string | The display name of the filter rule. | Yes | Only works in non-interactive mode. | +| --rule string | Filter rule expressions. Use "ticloud serverless audit-log filter template" to see filter templates. | Yes | Only works in non-interactive mode. | +| -h, --help | Shows help information for this command. | No | Works in both interactive and non-interactive modes. | ## Inherited flags | Flag | Description | Required | Note | |----------------------|------------------------------------------------------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------| -| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. | -| -P, --profile string | Specifies the active [user profile](/tidb-cloud/cli-reference.md#user-profile) used in this command. | No | Works in both non-interactive and interactive modes. | -| -D, --debug | Enables debug mode. | No | Works in both non-interactive and interactive modes. | +| -D, --debug | Enable debug mode. | No | Works in both interactive and non-interactive modes. | +| --no-color | Disable color output. | No | Only works in non-interactive mode. | +| -P, --profile string | Profile to use from your configuration file. | No | Works in both interactive and non-interactive modes. | ## Feedback diff --git a/tidb-cloud/ticloud-auditlog-filter-delete.md b/tidb-cloud/ticloud-serverless-audit-log-filter-rule-delete.md similarity index 61% rename from tidb-cloud/ticloud-auditlog-filter-delete.md rename to tidb-cloud/ticloud-serverless-audit-log-filter-rule-delete.md index 62c84224a68ff..2d47dc0f9d17d 100644 --- a/tidb-cloud/ticloud-auditlog-filter-delete.md +++ b/tidb-cloud/ticloud-serverless-audit-log-filter-rule-delete.md @@ -5,50 +5,42 @@ summary: The reference of `ticloud serverless audit-log filter-rule delete`. # ticloud serverless audit-log filter-rule delete -Delete an audit log filter rule for a {{{ .starter }}} or {{{ .essential }}} cluster. +Delete an audit log filter rule for a TiDB Cloud Essential cluster. ```shell ticloud serverless audit-log filter-rule delete [flags] ``` -Or use the following alias command: - -```shell -ticloud serverless audit-log filter delete [flags] -``` - ## Examples Delete an audit log filter rule in interactive mode: ```shell -ticloud serverless audit-log filter delete +ticloud serverless audit-log filter-rule delete ``` Delete an audit log filter rule in non-interactive mode: ```shell -ticloud serverless audit-log filter delete --cluster-id --name +ticloud serverless audit-log filter-rule delete --cluster-id --filter-rule-id ``` ## Flags -In non-interactive mode, you need to manually enter the required flags. In interactive mode, you can just follow CLI prompts to fill them in. - | Flag | Description | Required | Note | |-------------------------|-----------------------------------------------------|----------|------------------------------------------------------| | -c, --cluster-id string | The ID of the cluster. | Yes | Only works in non-interactive mode. | -| --name string | The name of the filter rule. | Yes | Only works in non-interactive mode. | -| --force | Deletes the filter rule without confirmation. | No | Works in both non-interactive and interactive modes. | -| -h, --help | Shows help information for this command. | No | Works in both non-interactive and interactive modes. | +| --filter-rule-id string | The ID of the filter rule. | Yes | Only works in non-interactive mode. | +| --force | Delete without confirmation. | No | Works in both interactive and non-interactive modes. | +| -h, --help | Shows help information for this command. | No | Works in both interactive and non-interactive modes. | ## Inherited flags | Flag | Description | Required | Note | |----------------------|------------------------------------------------------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------| -| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. | -| -P, --profile string | Specifies the active [user profile](/tidb-cloud/cli-reference.md#user-profile) used in this command. | No | Works in both non-interactive and interactive modes. | -| -D, --debug | Enables debug mode. | No | Works in both non-interactive and interactive modes. | +| -D, --debug | Enable debug mode. | No | Works in both interactive and non-interactive modes. | +| --no-color | Disable color output. | No | Only works in non-interactive mode. | +| -P, --profile string | Profile to use from your configuration file. | No | Works in both interactive and non-interactive modes. | ## Feedback diff --git a/tidb-cloud/ticloud-auditlog-filter-describe.md b/tidb-cloud/ticloud-serverless-audit-log-filter-rule-describe.md similarity index 63% rename from tidb-cloud/ticloud-auditlog-filter-describe.md rename to tidb-cloud/ticloud-serverless-audit-log-filter-rule-describe.md index 583a8c54bab95..da05cc59cf357 100644 --- a/tidb-cloud/ticloud-auditlog-filter-describe.md +++ b/tidb-cloud/ticloud-serverless-audit-log-filter-rule-describe.md @@ -5,49 +5,41 @@ summary: The reference of `ticloud serverless audit-log filter-rule describe`. # ticloud serverless audit-log filter-rule describe -Describe an audit log filter rule for a {{{ .starter }}} or {{{ .essential }}} cluster. +Describe an audit log filter rule for a TiDB Cloud Essential cluster. ```shell ticloud serverless audit-log filter-rule describe [flags] ``` -Or use the following alias command: - -```shell -ticloud serverless audit-log filter describe [flags] -``` - ## Examples Describe an audit log filter rule in interactive mode: ```shell -ticloud serverless audit-log filter describe +ticloud serverless audit-log filter-rule describe ``` Describe an audit log filter rule in non-interactive mode: ```shell -ticloud serverless audit-log filter describe --cluster-id --name +ticloud serverless audit-log filter-rule describe --cluster-id --filter-rule-id ``` ## Flags -In non-interactive mode, you need to manually enter the required flags. In interactive mode, you can just follow CLI prompts to fill them in. - | Flag | Description | Required | Note | |-------------------------|------------------------------|----------|------------------------------------------------------| | -c, --cluster-id string | The ID of the cluster. | Yes | Only works in non-interactive mode. | -| --name string | The name of the filter rule. | Yes | Only works in non-interactive mode. | -| -h, --help | Shows help information for this command. | No | Works in both non-interactive and interactive modes. | +| --filter-rule-id string | The ID of the filter rule. | Yes | Only works in non-interactive mode. | +| -h, --help | Shows help information for this command. | No | Works in both interactive and non-interactive modes. | ## Inherited flags | Flag | Description | Required | Note | |----------------------|------------------------------------------------------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------| -| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. | -| -P, --profile string | Specifies the active [user profile](/tidb-cloud/cli-reference.md#user-profile) used in this command. | No | Works in both non-interactive and interactive modes. | -| -D, --debug | Enables debug mode. | No | Works in both non-interactive and interactive modes. | +| -D, --debug | Enable debug mode. | No | Works in both interactive and non-interactive modes. | +| --no-color | Disable color output. | No | Only works in non-interactive mode. | +| -P, --profile string | Profile to use from your configuration file. | No | Works in both interactive and non-interactive modes. | ## Feedback diff --git a/tidb-cloud/ticloud-auditlog-filter-list.md b/tidb-cloud/ticloud-serverless-audit-log-filter-rule-list.md similarity index 57% rename from tidb-cloud/ticloud-auditlog-filter-list.md rename to tidb-cloud/ticloud-serverless-audit-log-filter-rule-list.md index a56588e260cea..194647e5f0124 100644 --- a/tidb-cloud/ticloud-auditlog-filter-list.md +++ b/tidb-cloud/ticloud-serverless-audit-log-filter-rule-list.md @@ -5,55 +5,49 @@ summary: The reference of `ticloud serverless audit-log filter-rule list`. # ticloud serverless audit-log filter-rule list -List audit log filter rules for a {{{ .starter }}} or {{{ .essential }}} cluster. +List audit log filter rules for a TiDB Cloud Essential cluster. ```shell ticloud serverless audit-log filter-rule list [flags] ``` -Or use the following alias command: - -```shell -ticloud serverless audit-log filter list [flags] -``` - ## Examples List all audit log filter rules in interactive mode: ```shell -ticloud serverless audit-log filter list +ticloud serverless audit-log filter-rule list ``` List all audit log filter rules in non-interactive mode: ```shell -ticloud serverless audit-log filter list -c +ticloud serverless audit-log filter-rule list -c ``` List all audit log filter rules with JSON format in non-interactive mode: ```shell -ticloud serverless audit-log filter list -c -o json +ticloud serverless audit-log filter-rule list -c -o json ``` ## Flags -In non-interactive mode, you need to manually enter the required flags. In interactive mode, you can just follow CLI prompts to fill them in. - | Flag | Description | Required | Note | |-------------------------|---------------------------------------------------------------------------------------------------|----------|------------------------------------------------------| -| -c, --cluster-id string | The ID of the cluster whose audit log filter rules you want to list. | No | Only works in non-interactive mode. | -| -o, --output string | Specifies the output format (`human` by default). Valid values are `human` or `json`. To get a complete result, use the `json` format. | No | Works in both non-interactive and interactive modes. | -| -h, --help | Shows help information for this command. | No | Works in both non-interactive and interactive modes. | +| -c, --cluster-id string | The cluster ID of the audit log filter rules to be listed. | No | Only works in non-interactive mode. | +| -o, --output string | Output format, one of ["human", "json"]. For the complete result, please use json format. (default "human") | No | Works in both interactive and non-interactive modes. | +| -h, --help | Shows help information for this command. | No | Works in both interactive and non-interactive modes. | ## Inherited flags | Flag | Description | Required | Note | |----------------------|------------------------------------------------------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------| -| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. | -| -P, --profile string | Specifies the active [user profile](/tidb-cloud/cli-reference.md#user-profile) used in this command. | No | Works in both non-interactive and interactive modes. | -| -D, --debug | Enables debug mode. | No | Works in both non-interactive and interactive modes. | +| -D, --debug | Enable debug mode. | No | Works in both interactive and non-interactive modes. | +| --no-color | Disable color output. | No | Only works in non-interactive mode. | +| -P, --profile string | Profile to use from your configuration file. | No | Works in both interactive and non-interactive modes. | + +## SEE ALSO ## Feedback diff --git a/tidb-cloud/ticloud-auditlog-filter-template.md b/tidb-cloud/ticloud-serverless-audit-log-filter-rule-template.md similarity index 58% rename from tidb-cloud/ticloud-auditlog-filter-template.md rename to tidb-cloud/ticloud-serverless-audit-log-filter-rule-template.md index cf6482a239b69..ce91f014a4357 100644 --- a/tidb-cloud/ticloud-auditlog-filter-template.md +++ b/tidb-cloud/ticloud-serverless-audit-log-filter-rule-template.md @@ -5,48 +5,40 @@ summary: The reference of `ticloud serverless audit-log filter-rule template`. # ticloud serverless audit-log filter-rule template -Show audit log filter rule templates for a {{{ .starter }}} or {{{ .essential }}} cluster. +Show audit log filter rule templates for a TiDB Cloud Essential cluster. ```shell ticloud serverless audit-log filter-rule template [flags] ``` -Or use the following alias command: - -```shell -ticloud serverless audit-log filter template [flags] -``` - ## Examples Show filter templates in interactive mode: ```shell -ticloud serverless audit-log filter template +ticloud serverless audit-log filter-rule template ``` Show filter templates in non-interactive mode: ```shell -ticloud serverless audit-log filter template --cluster-id +ticloud serverless audit-log filter-rule template --cluster-id ``` ## Flags -In non-interactive mode, you need to manually enter the required flags. In interactive mode, you can just follow CLI prompts to fill them in. - | Flag | Description | Required | Note | |-------------------------|------------------------------|----------|------------------------------------------------------| -| -c, --cluster-id string | The ID of the cluster (optional, for context if templates might become cluster-specific). | No | Only works in non-interactive mode. | -| -h, --help | Shows help information for this command. | No | Works in both non-interactive and interactive modes. | +| -c, --cluster-id string | The ID of the cluster. | No | Only works in non-interactive mode. | +| -h, --help | Shows help information for this command. | No | Works in both interactive and non-interactive modes. | ## Inherited flags | Flag | Description | Required | Note | |----------------------|------------------------------------------------------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------| -| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. | -| -P, --profile string | Specifies the active [user profile](/tidb-cloud/cli-reference.md#user-profile) used in this command. | No | Works in both non-interactive and interactive modes. | -| -D, --debug | Enables debug mode. | No | Works in both non-interactive and interactive modes. | +| -D, --debug | Enable debug mode. | No | Works in both interactive and non-interactive modes. | +| --no-color | Disable color output. | No | Only works in non-interactive mode. | +| -P, --profile string | Profile to use from your configuration file. | No | Works in both interactive and non-interactive modes. | ## Feedback diff --git a/tidb-cloud/ticloud-auditlog-filter-update.md b/tidb-cloud/ticloud-serverless-audit-log-filter-rule-update.md similarity index 55% rename from tidb-cloud/ticloud-auditlog-filter-update.md rename to tidb-cloud/ticloud-serverless-audit-log-filter-rule-update.md index 376cd4760ea38..21b6fe2e204ca 100644 --- a/tidb-cloud/ticloud-auditlog-filter-update.md +++ b/tidb-cloud/ticloud-serverless-audit-log-filter-rule-update.md @@ -5,63 +5,56 @@ summary: The reference of `ticloud serverless audit-log filter-rule update`. # ticloud serverless audit-log filter-rule update -Update an audit log filter rule for a {{{ .starter }}} or {{{ .essential }}} cluster. +Update an audit log filter rule for a TiDB Cloud Essential cluster. ```shell ticloud serverless audit-log filter-rule update [flags] ``` -Or use the following alias command: - -```shell -ticloud serverless audit-log filter update [flags] -``` - ## Examples Update an audit log filter rule in interactive mode: ```shell -ticloud serverless audit-log filter update +ticloud serverless audit-log filter-rule update ``` -Enable an audit log filter rule in non-interactive mode: +Enable audit log filter rule in non-interactive mode: ```shell -ticloud serverless audit-log filter update --cluster-id --name --enabled +ticloud serverless audit-log filter-rule update --cluster-id --filter-rule-id --enabled ``` -Disable an audit log filter rule in non-interactive mode: +Disable audit log filter rule in non-interactive mode: ```shell -ticloud serverless audit-log filter update --cluster-id --name --enabled=false +ticloud serverless audit-log filter-rule update --cluster-id --filter-rule-id --enabled=false ``` Update filters of an audit log filter rule in non-interactive mode: ```shell -ticloud serverless audit-log filter update --cluster-id --name --rule '{"users":["%@%"],"filters":[{"classes":["QUERY"],"tables":["test.t"]}]}' +ticloud serverless audit-log filter-rule update --cluster-id --filter-rule-id --rule '{"users":["%@%"],"filters":[{"classes":["QUERY"],"tables":["test.t"]}]}' ``` ## Flags -In non-interactive mode, you need to manually enter the required flags. In interactive mode, you can just follow CLI prompts to fill them in. - | Flag | Description | Required | Note | |-------------------------|-------------------------------------------------------------------------------------------------------------|----------|------------------------------------------------------| | -c, --cluster-id string | The ID of the cluster. | Yes | Only works in non-interactive mode. | -| --name string | The name of the filter rule to update. | Yes | Only works in non-interactive mode. | -| --enabled | Enables or disables the filter rule. | No | Only works in non-interactive mode. | -| --rule string | The new, complete filter rule expression. Use `ticloud serverless audit-log filter template` to see filter templates. | No | Only works in non-interactive mode. | -| -h, --help | Shows help information for this command. | No | Works in both non-interactive and interactive modes. | +| --display-name string | The display name of the filter rule. | No | Only works in non-interactive mode. | +| --enabled | Enable or disable the filter rule. | No | Only works in non-interactive mode. | +| --filter-rule-id string | The ID of the filter rule. | Yes | Only works in non-interactive mode. | +| --rule string | Complete filter rule expressions. Use "ticloud serverless audit-log filter template" to see filter templates. | No | Only works in non-interactive mode. | +| -h, --help | Shows help information for this command. | No | Works in both interactive and non-interactive modes. | ## Inherited flags | Flag | Description | Required | Note | |----------------------|------------------------------------------------------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------| -| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. | -| -P, --profile string | Specifies the active [user profile](/tidb-cloud/cli-reference.md#user-profile) used in this command. | No | Works in both non-interactive and interactive modes. | -| -D, --debug | Enables debug mode. | No | Works in both non-interactive and interactive modes. | +| -D, --debug | Enable debug mode. | No | Works in both interactive and non-interactive modes. | +| --no-color | Disable color output. | No | Only works in non-interactive mode. | +| -P, --profile string | Profile to use from your configuration file. | No | Works in both interactive and non-interactive modes. | ## Feedback