This API is used to set a policy for SQL audit logs.
POST https://{Endpoint}/v3/{project_id}/instances/{instance_id}/auditlog-policy
Name |
Mandatory |
Description |
---|---|---|
project_id |
Yes |
Specifies the project ID of a tenant in a region. |
instance_id |
Yes |
Specifies the instance ID, which can be obtained by calling the API for querying instances. If you do not have an instance, you can call the API used for creating an instance. |
Name |
Mandatory |
Type |
Description |
---|---|---|---|
keep_days |
Yes |
Integer |
Specifies the number of days for storing audit logs. The value can be 0 or ranges from 7 to 732.
|
reserve_auditlogs |
No |
String |
This parameter is valid only when SQL audit is disabled.
|
audit_scope |
No |
String |
This parameter is valid only when the audit log policy is enabled. If this parameter is left blank or set to all, all audit log policies are enabled by default. Audit scope: Enter the database or collection name. Use commas (,) to separate multiple databases or collections. If the name contains a comma (,), add a dollar sign ($) before the comma to distinguish it from the separators. Enter a maximum of 1024 characters. The value cannot contain spaces or the following special characters "[]{}():? The dollar sign ($) can be used only in escape mode. |
audit_types |
No |
Array of strings |
This parameter is valid only when the audit log policy is enabled. If this parameter is left blank, all audit log policies are enabled by default. Specifies the audit type. The value is auth, insert, delete, update, query, or command. |
{ "keep_days": 7, "audit_scope": "all", "audit_types": [ "insert" ] }
{ "keep_days": 0, "reserve_auditlogs": false }
{}
For more information, see Error Code.