Querying Global Traces
Function
This API is used to query global traces reported by cloud services, such as login and logout traces reported by IAM.
This API can be called only by the domain name of the cts.cn-north-4.myhuaweicloud.com in North China – Beijing4.
URI
GET /v2.0/domains/{domainId}/traces?pageIndex,pageSize,event_type,type,isDesc,endTime,startTime,service_type,user,trace_rating,resource_id,record_time
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| domainId | Yes | String | Tenant ID. |
| pageIndex | No | int | Page |
| event_type | Yes | String | Trace source. Currently, the value is fixed to global. |
| resource_type | No | String | Resource type |
| type | No | String | Query mode. When the query mode is next or pre, record_time must be used.
|
| isDesc | No | Boolean | Ascending or descending order |
| startTime | No | long | Query start time. |
| endTime | No | long | Query end time. |
| service_type | No | String | Service name |
| user | No | String | User name |
| trace_rating | No | String | Event Status |
| resource_id | No | String | Resource ID. |
| record_time | No | long | Record time (used for sorting and similar to lineNum). It is used when a query is performed downward or upward. Its value is the value of record_time in the last record. |
Request
- Example request
GET Initial request /v2.0/domains/2306579dc99f4c8690b14b68e734fcd9/traces?pageIndex=1&pageSize=50&event_type=global&type=init&isDesc=true&isConsole=true&endTime=1567479037112&startTime=1566874237112&service_type=IAM&user=paas_cts_z00418070_01&resource_type=user&trace_rating=normal Downward query /v2.0/domains/2306579dc99f4c8690b14b68e734fcd9/traces?pageIndex=1&pageSize=50&event_type=global&type=next&isDesc=true&isConsole=true&record_time=1567071858959000001&endTime=1567479122688&startTime=1566874322688&service_type=IAM&user=paas_cts_z00418070_01&resource_type=user&trace_rating=normal
Response
- Parameter description
Table 2 Parameters in the response Parameter
Type
Description
total
int
Total number of the queried traces
data
array
Queried traces
Table 3 Data structure description of the data field Parameter
Type
Description
resource_id
String
ID of the cloud service resource corresponding to the trace.
trace_name
String
Name of the trace in the trace list.
trace_status
String
Trace status. The options are as follows: normal, warning and incident.
trace_type
String
Trace type, including API calling (ApiCall), console page calling (ConsoleAction), and inter-system calling (SystemAction).
request
Structure
Request of an operation on resources.
response
Structure
Response to the user request, that is, the response to the resource operation result.
code
String
The HTTP status code returned by the API recorded in the trace.
api_version
String
Version of the cloud service API.
message
String
Remarks added by other cloud services to the trace.
record_time
Long
Trace time recorded by CTS.
trace_id
String
Trace ID, which is automatically generated by the system.
time
Long
Time when a trace occurs.
user
Structure
Information about the user who triggers the trace.
service_type
String
Type of a 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.
resource_type
String
Type of a resource whose traces are to be queried.
source_ip
String
IP address of the tenant that triggers the trace.
resource_name
String
Name of the resource corresponding to the trace.
request_id
String
Request ID.
location_info
String
Auxiliary information required for locating a request error.
endpoint
String
Cloud resource details page
resource_url
String
Link to the cloud resource details page (excluding the endpoint)
- Example response
{"total":50,"data":[{"context":"{\"code\":\"302\",\"source_ip\":\"100.79.4.140\",\"trace_type\":\"ConsoleAction\",\"event_type\":\"<HighLightTag>global</HighLightTag>\",\"project_id\":\"16edf66e79d04187acb99a463e610764\",\"trace_id\":\"f95d3c01-cdf1-11e9-8b03-011bbe3a6405\",\"trace_name\":\"login\",\"resource_type\":\"<HighLightTag>user</HighLightTag>\",\"trace_rating\":\"<HighLightTag>normal</HighLightTag>\",\"service_type\":\"<HighLightTag>IAM</HighLightTag>\",\"resource_id\":\"f3f18b9215014f0d9ded3045af020811\",\"tracker_name\":\"<HighLightTag>global</HighLightTag>\",\"time\":\"1567477476534\",\"resource_name\":\"<HighLightTag>paas_cts_z00418070_01</HighLightTag>\",\"record_time\":\"1567477476596\",\"<HighLightTag>user</HighLightTag>\":\"{\\\"name\\\":\\\"<HighLightTag>paas_cts_z00418070_01</HighLightTag>\\\",\\\"id\\\":\\\"f3f18b9215014f0d9ded3045af020811\\\",\\\"domain\\\":{\\\"name\\\":\\\"<HighLightTag>paas_cts_z00418070_01</HighLightTag>\\\",\\\"id\\\":\\\"2306579dc99f4c8690b14b68e734fcd9\\\"}}\"}","record_time":"1567477476596000001"}]}
Returned Value
- Normal
Table 4 Return code for successful requests Returned Value
Description
200
The request is successful and the query result is returned.
- Abnormal
Table 5 Return code for failed requests Returned Value
Description
403
Unauthorized.
500
Failed to complete the request because of an internal service error.
404
The requested trace does not exist.
Last Article: Querying a Trace List
Next Article: Appendix
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.