Obtaining Audit Logs
Function
This API is used to obtain audit logs. Before calling this API:
- Learn how to authenticate it.
- Obtain the required region and endpoint.
URI
GET /v3/{project_id}/instances/{instance_id}/audit-logs
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID. Constraints N/A Range The value contains 32 characters. Only letters and digits are allowed. Default Value N/A |
| instance_id | Yes | String | Definition Instance ID, which uniquely identifies an instance. Constraints N/A Range The value contains 36 characters with a suffix of in07. Only letters and digits are allowed. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| start_time | Yes | String | Definition Query start time. Constraints The value is in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. Range N/A Default Value N/A |
| end_time | Yes | String | Definition Query end time. Constraints The value is in the "yyyy-mm-ddThh:mm:ssZ" format. The end time must be later than the start time and the time span cannot be longer than 30 days. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. Range N/A Default Value N/A |
| offset | Yes | Integer | Definition Index offset. The query starts from the next piece of data indexed by this parameter. Constraints The value must be an integer and cannot be a negative number. Range ≥ 0 Default Value 0 |
| limit | Yes | Integer | Definition Number of records to be queried. Constraints The value must be an integer and cannot be a negative number. Range 1–100 Default Value 10 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. To obtain this value, call the IAM API for obtaining a user token. The value of X-Subject-Token in the response header is the token value. Constraints N/A Range N/A Default Value N/A |
| X-Language | No | String | Definition Request language type. Constraints N/A Range Default Value en-us |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| audit_logs | Array of AuditLogDetail objects | Definition List of records. Range N/A |
| total_count | Integer | Definition Total number of records. Range ≥ 0 |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Audit log ID. Range N/A |
| name | String | Definition Audit log file name. Range N/A |
| size | Long | Definition Audit log size, in KB. Range N/A |
| begin_time | String | Definition Start time of the audit log. The format is yyyy-mm-ddThh:mm:ssZ. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. Range N/A |
| end_time | String | Definition End time of the audit log. The format is yyyy-mm-ddThh:mm:ssZ. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. Range N/A |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error message. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error message. |
Example Request
GET https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances/3d39c18788b54a919bab633874c159dfin01/audit-logs?start_time=2018-09-15T06:25:43+0800&end_time=2018-09-16T10:40:15+0800&offset=0&limit=10 Example Response
Status code: 200
Success.
{
"audit_logs" : [ {
"id" : "fa163ea0e2bet11e9d832166a2cf894c5br01",
"name" : "317156_20190916032844_eb8fe5d181ec44a2850302691541f760in01_Audit_166a2cf8-d832-11e9-94c5-fa163ea0e2be",
"size" : 20481.835938,
"begin_time" : "2019-11-06T09:03:34+0800",
"end_time" : "2019-11-06T10:39:15+0800"
}, {
"id" : "fa163ea0e2bet11e9d832136a668094c5br01",
"name" : "317162_20190916032838_eb8fe5d181ec44a2850302691541f760in01_Audit_136a6680-d832-11e9-94c5-fa163ea0e2be",
"size" : 20481.835938,
"begin_time" : "2019-11-07T09:04:35+0800",
"end_time" : "2019-11-07T10:38:16+0800"
} ],
"total_count" : 2
} Status Code
For details, see Status Codes.
Error Code
For details, see Error Codes.