Querying a Trace List
Function
This API is used to query records of operations on resources in the last seven days.
URI
GET /v3/{project_id}/traces
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Identifies a project. For details, see section "Obtaining the Account ID and Project ID" in Cloud Trace Service API Reference. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
trace_type |
Yes |
String |
Indicates the trace type. The value can be system (indicating a management trace) or data (indicating a data trace) The default value is system. Enumeration values:
|
limit |
No |
Integer |
Indicates the number of traces to query. The default value is 10 and the maximum value is 200. |
from |
No |
Long |
Indicates the UTC millisecond timestamp of the start time of the query. The value contains 13 digits and the default value is the timestamp of the last hour. Traces generated after the specified timestamp will be queried. The parameters from and to should be used together. |
next |
No |
String |
This parameter is used to query traces generated earlier than its specified value. The value can be that of marker in the response. next can be used with from and to. Traces generated in the overlap of the two time ranges specified respectively by next and by from and to will be returned. |
to |
No |
Long |
Indicates the UTC millisecond timestamp of the end time of the query. The value contains 13 digits and the default value is the timestamp of the current time. Traces generated before the specified timestamp will be queried. The parameters to and from should be used together. |
tracker_name |
No |
String |
When trace_type is set to system, the value of this parameter is system. When trace_type is set to data, set this parameter to the name of a data tracker to query the traces recorded by this tracker. |
service_type |
No |
String |
Indicates the cloud service whose traces are to be queried. The value must be the abbreviation of a cloud service that has been interconnected with CTS. It is a word composed of uppercase letters. This parameter is valid only when trace_type is set to system. For cloud services that have been interconnected with CTS, see section "Supported Services and Operation Lists" in the Cloud Trace Service User Guide. |
user |
No |
String |
Indicates the name of a user whose traces are to be queried. This parameter is valid only when trace_type is set to system. |
resource_id |
No |
String |
Identifies a cloud resource whose traces are to be queried. This parameter is valid only when trace_type is set to system. |
resource_name |
No |
String |
Indicates the name of a resource whose traces are to be queried. This parameter is valid only when trace_type is set to system. The value can contain uppercase letters. |
resource_type |
No |
String |
Indicates the type of a resource whose traces are to be queried. This parameter is valid only when trace_type is set to system. |
trace_id |
No |
String |
Identifies a trace. If this parameter is specified, other query criteria will not take effect. This parameter is valid only when trace_type is set to system. |
trace_name |
No |
String |
Indicates the name of a trace. This parameter is valid only when trace_type is set to system. The value can contain uppercase letters. |
trace_rating |
No |
String |
Indicates the rating of a trace. The value can be normal, warning, or incident. This parameter is valid only when trace_type is set to system. Enumeration values:
|
Request Parameters
None
Response Parameters
If a status code 200is returned, see the parameters in the following tables.
Parameter |
Type |
Description |
---|---|---|
traces |
Array of Traces objects |
Indicates the returned list of traces. |
meta_data |
MetaData object |
Indicates the number of returned traces and the marker. |
Parameter |
Type |
Description |
---|---|---|
resource_id |
String |
Identifies a cloud resource on which the recorded operation was performed. |
trace_name |
String |
Indicates the name of a trace. The value is a string of 1 to 64 characters and must start with a letter. It can contain uppercase and lowercase letters, digits, hyphens (-), underscores (_), and periods (.). |
trace_rating |
String |
Indicates the rating of a trace. The value can be normal, warning, or incident. Enumeration values:
|
trace_type |
String |
Indicates the trace source. For management traces, the value can be ApiCall, ConsoleAction, or SystemAction. For data traces, the value can be ObsSDK or ObsAPI. |
request |
String |
Indicates the request body of the recorded operation. |
response |
String |
Indicates the response body of the recorded operation. |
code |
String |
Indicates the returned HTTP status code of the recorded operation. |
api_version |
String |
Indicates the version of the API called in the trace. |
message |
String |
Indicates the remarks added by other cloud services to the trace. |
record_time |
Long |
Indicates the timestamp when a trace was recorded by CTS. |
trace_id |
String |
Identifies a trace. The value is the UUID generated by the system. |
time |
Long |
Indicates the timestamp when a trace was generated. |
user |
UserInfo object |
Indicates the information of the user who performed the operation that triggered the trace. |
service_type |
String |
Indicates the cloud service on which the recorded operation was performed. The value must be the abbreviation of a cloud service that has been interconnected with CTS. It is a word composed of uppercase letters. |
resource_type |
String |
Indicates the type of the resource on which the recorded operation was performed. |
source_ip |
String |
Indicates the IP address of the tenant who performed the operation that triggered the trace. |
resource_name |
String |
Indicates the name of the resource on which the recorded operation was performed. |
request_id |
String |
Identifies the request of the recorded operation. |
location_info |
String |
Indicates the information required for fault locating after a request error occurred. |
endpoint |
String |
Indicates the endpoint in the detail page URL of the cloud resource on which the recorded operation was performed. |
resource_url |
String |
Indicates the detail page URL (excluding the endpoint) of the cloud resource on which the recorded operation was performed. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Identifies an account. For details, see section "Obtaining the Account ID and Project ID" in Cloud Trace Service API Reference. |
name |
String |
Indicates the account name. |
domain |
BaseUser object |
Indicates the domain information of the user who performed the operation that triggered the trace. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Identifies an account. For details, see section "Obtaining the Account ID and Project ID" in Cloud Trace Service API Reference. |
name |
String |
Indicates the account name. |
Parameter |
Type |
Description |
---|---|---|
count |
Integer |
Indicates the number of returned traces. |
marker |
String |
Identifies the last trace returned. The value of this parameter can be used as the value of next. If the value of marker is null, all traces have been returned under the specified query criteria. |
If a status code 400is returned, see the parameters in the following tables.
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Indicates an error code, in the format of CTS.XXX. |
error_msg |
String |
Indicates the error description. |
Request Examples
-
Example request for querying management traces
GET https://{endpoint}/v3/{project_id}/traces?limit=11&to=1479095278000&from=1478490478000&trace_name=createTracker&resource_type=tracker&service_type=CTS&trace_type=system
-
Example request for querying data traces
GET https://{endpoint}/v3/{project_id}/traces?limit=11&to=1479095278000&from=1478490478000&trace_type=data
Response Examples
Status code: 200
The request is successful.
{ "meta_data" : { "count" : 2, "marker" : "e001ccb8-bc09-11e6-b2cc-2640a43cc6e8" }, "traces" : [ { "time" : 1472148708232, "user" : { "name" : "xxx", "domain" : { "name" : "xxx", "id" : "ded649d814464428ba89d04d7955c93e" } }, "response" : { "code" : "VPC.0514", "message" : "Update port fail." }, "code" : 200, "service_type" : "VPC", "resource_type" : "eip", "resource_name" : "192.144.163.1", "resource_id" : "d502809d-0d1d-41ce-9690-784282142ccc", "trace_name" : "deleteEip", "trace_rating" : "warning", "trace_type" : "ConsoleAction", "api_version" : "2.0", "record_time" : 1481066128032, "trace_id" : "e001ccb9-bc09-11e6-b00b-4b2a61338db6" }, { "time" : 1472148708232, "user" : { "name" : "xxx", "domain" : { "name" : "xxx", "id" : "ded649d814464428ba89d04d7955c93e" } }, "response" : { "code" : "VPC.0514", "message" : "Update port fail." }, "code" : 200, "service_type" : "VPC", "resource_type" : "eip", "resource_name" : "192.144.163.1", "resource_id" : "d502809d-0d1d-41ce-9690-784282142ccc", "trace_name" : "deleteEip", "trace_rating" : "warning", "trace_type" : "ConsoleAction", "api_version" : "2.0", "record_time" : 1481066128032, "trace_id" : "e001ccb8-bc09-11e6-b2cc-2640a43cc6e8" } ] }
Status Codes
Status Code |
Description |
---|---|
200 |
The request is successful. |
400 |
The query parameters are abnormal. |
401 |
The request is rejected due to authentication failure. |
403 |
The server understood the request but refused to authorize it. |
404 |
The requested trace does not exist. |
500 |
The server has received the request but encountered an internal error. |
503 |
The requested service is unavailable. The client should not repeat the request without modifications. |
Error Codes
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