Setting SQL Audit
Function
This API is used to set a policy for SQL audit logs.
- Before calling this API, learn how to authenticate it.
- Before calling this API, learn about request header parameters.
Constraints
This API is available only to RDS for MySQL and RDS for PostgreSQL.
URI
- Parameter description
Table 1 Parameters Parameter
Mandatory
Description
project_id
Yes
Project ID of a tenant in a region.
To obtain the value, see Obtaining a Project ID.
instance_id
Yes
Specifies the DB instance ID.
Request
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
keep_days |
Yes |
Integer |
Number of days for storing audit logs. The value range is from 0 to 732.
|
reserve_auditlogs |
No |
Boolean |
This parameter is valid only when SQL audit is disabled.
|
audit_types |
No |
Array of strings |
This parameter applies only to RDS for MySQL. Operation types recorded in audit logs. This parameter is valid only when audit logging is enabled. If this parameter is left blank, all operation types will be recorded by default.
|
Example Request
- Enable SQL Audit and set the audit log retention period to 5 days.
PUT https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/cee5265e1e5845649e354841234567dfin01/auditlog-policy { "keep_days":5, "audit_types": [ "CREATE_USER" ] }
- Disable SQL Audit and delete existing historical audit logs.
{ "keep_days":0, "reserve_auditlogs":false }
Response
- Normal response
Table 3 Parameters Parameter
Type
Description
status
String
Definition
Result of setting SQL audit.
Range
COMPLETED
- Example normal response
{ "status":"COMPLETED" }
- Abnormal response
For details, see Abnormal Request Results.
Status Code
- Normal
- Abnormal
For details, see Status Codes.
Error Code
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot