Creating a Tracker
Function
When you have subscribed to CTS, a tracker is automatically created to associate with the cloud services you are using and record all operations on the services. A management tracker and multiple data trackers can be created by an account in a region. Operation records are retained for 7 days and you can check the records on the CTS console. To store records for a longer period, you can dump records in real time to an Object Storage Service (OBS) bucket.
URI
POST /v3/{project_id}/tracker
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. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
tracker_type |
Yes |
String |
Indicates the tracker type. The value can be system (indicating a management tracker), or data (indicating a data tracker). Both data and management trackers have the following parameters: is_lts_enabled and obs_info. Parameters for management trackers: is_support_trace_files_encryption, kms_id, is_support_validate, and is_support_validate Parameters for data trackers: tracker_name and data_bucket. Enumeration values:
|
tracker_name |
Yes |
String |
Indicates the tracker name. When tracker_type is set to system, the default value system is used. When tracker_type is set to data, you need to set this parameter to a tracker name. |
is_lts_enabled |
No |
Boolean |
Indicates whether to enable trace analysis. |
obs_info |
No |
TrackerObsInfo object |
Indicates the configurations of an OBS bucket to which traces will be transferred. |
is_support_trace_files_encryption |
No |
Boolean |
Indicates whether trace files are encrypted during transfer to an OBS bucket. This parameter is valid only when tracker_type is set to system. It must be used together with kms_id. |
kms_id |
No |
String |
Identifies a key used for trace file encryption. The key ID is obtained from Key Management Service (KMS). This parameter is valid only when tracker_type is set to system. This parameter is mandatory when is_support_trace_files_encryption is set to true. |
is_support_validate |
No |
Boolean |
Indicates whether to enable trace file verification during trace transfer. This parameter is valid only when tracker_type is set to system. |
data_bucket |
No |
DataBucket object |
Indicates the information of an OBS bucket to be tracked. This parameter is valid when tracker_type is set to data. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
bucket_name |
No |
String |
Indicate the name of an OBS bucket. The value contains 3 to 63 characters and must start with a digit or lowercase letter. Only lowercase letters, digits, hyphens (-), and periods (.) are allowed. |
file_prefix_name |
No |
String |
Indicates a file name prefix to mark trace files that need to be stored in an OBS bucket. The value contains 0 to 64 characters. Only uppercase and lowercase letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. |
is_obs_created |
No |
Boolean |
Indicates whether to create a new OBS bucket. When the value is true, you can create an OBS bucket to store trace files. When the value is false, you can select an existing OBS bucket to store trace files. |
bucket_lifecycle |
No |
Integer |
Indicates the duration that traces are stored in the OBS bucket. This parameter is valid only when tracker_type is set to data. Enumeration values:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
data_bucket_name |
No |
String |
Indicates the name of the bucket tracked by a data tracker.
|
data_event |
No |
Array of strings |
Indicates the type of operations tracked by a data tracker.
Enumeration values:
|
Response Parameters
If a status code 201is returned, see the parameters in the following tables.
Parameter |
Type |
Description |
---|---|---|
id |
String |
Uniquely identifies a tracker. |
create_time |
Long |
Indicates the timestamp when the tracker was created. |
kms_id |
String |
Identifies a key used for trace file encryption. The key ID is obtained from Key Management Service (KMS). This parameter is mandatory when tracker_type is set to system and is_support_trace_files_encryption is set to true. |
is_support_validate |
Boolean |
Indicates whether to enable the trace file verification. This function is supported only when the value of tracker_type is system. |
lts |
Lts object |
Indicates detail about trace analysis. |
tracker_type |
String |
Indicates the tracker type. The value can be system (indicating a management tracker), or data (indicating a data tracker). Enumeration values:
|
domain_id |
String |
Identifies an account. For details, see section "Obtaining the Account ID and Project ID" in Cloud Trace Service API Reference. |
project_id |
String |
Identifies a project. |
tracker_name |
String |
Indicates the tracker name. The value is system. |
status |
String |
Indicates the status of a tracker. The value can be enabled, disabled, or error. If the value is error, the detail field is required for specifying the source of the error. Enumeration values:
|
detail |
String |
This parameter is returned only when the tracker status is error. It indicates the cause of the abnormal status, and its value can be bucketPolicyError, noBucket, or arrears. |
is_support_trace_files_encryption |
Boolean |
Indicates whether trace files are encrypted during transfer to an OBS bucket. This parameter must be used together with kms_id. This function is supported only when the value of tracker_type is system. |
obs_info |
ObsInfo object |
Indicates the Information about the bucket to which traces are transferred. |
data_bucket |
DataBucketQuery object |
Indicates the Information about the bucket tracked by a data tracker. This parameter is valid only when tracker_type is set to data. |
Parameter |
Type |
Description |
---|---|---|
is_lts_enabled |
Boolean |
Indicates whether traces are synchronized to LTS for trace search and analysis. |
log_group_name |
String |
Indicates the name of the log group that CTS creates in LTS. |
log_topic_name |
String |
Indicates the name of the log stream that CTS creates in LTS. |
Parameter |
Type |
Description |
---|---|---|
bucket_name |
String |
Indicate the name of an OBS bucket. The value contains 3 to 63 characters and must start with a digit or lowercase letter. Only lowercase letters, digits, hyphens (-), and periods (.) are allowed. |
file_prefix_name |
String |
Indicates a file name prefix to mark trace files that need to be stored in an OBS bucket. The value contains 0 to 64 characters. Only uppercase and lowercase letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. |
is_obs_created |
Boolean |
Indicates whether the OBS bucket is automatically created by the tracker. |
is_authorized_bucket |
Boolean |
Indicates whether CTS has been granted permissions to perform operations on the OBS bucket. |
bucket_lifecycle |
Long |
Indicates the duration that traces are stored in the OBS bucket. This parameter is valid only when tracker_type is set to data. |
Parameter |
Type |
Description |
---|---|---|
data_bucket_name |
String |
Indicate the name of an OBS bucket. The value contains 3 to 63 characters and must start with a digit or lowercase letter. Only lowercase letters, digits, hyphens (-), and periods (.) are allowed. |
search_enabled |
Boolean |
Indicates whether the logs of the tracked bucket can be searched. |
data_event |
Array of strings |
Indicates the operations to track. Enumeration values:
|
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 creating a management tracker
POST https://{endpoint}/v3/{project_id}/tracker { "tracker_type" : "system", "tracker_name" : "system", "obs_info" : { "is_obs_created" : false, "bucket_name" : "test-data-tracker", "file_prefix_name" : "11" }, "is_lts_enabled" : true, "is_support_trace_files_encryption" : true, "kms_id" : "13a4207c-7abe-4b68-8510-16b84c3b5504", "is_support_validate" : true }
-
Example request for creating a data tracker
{ "tracker_type" : "data", "tracker_name" : "data-tracker-name", "obs_info" : { "is_obs_created" : false, "bucket_name" : "saveTraceBucket", "file_prefix_name" : "11", "bucket_lifecycle" : 30 }, "is_lts_enabled" : true, "data_bucket" : { "data_event" : [ "READ", "WRITE" ], "data_bucket_name" : "cstest0423" } }
Response Examples
Status code: 201
The request is successful.
{ "id" : "2e6fa9b8-8c6e-456d-b5d3-77be972d220b", "create_time" : 1587958482923, "domain_id" : "aexxxxxxxx4d4fb4bexxxxxxx791fbf", "is_support_trace_files_encryption" : true, "kms_id" : "13a4207c-7abe-4b68-8510-16b84c3b5504", "obs_info" : { "is_obs_created" : false, "bucket_name" : "test-bucket", "is_authorized_bucket" : false, "file_prefix_name" : "11", "bucket_lifecycle" : 30 }, "project_id" : "bb1xxxxxxxxe4f498cbxxxxxxxx35634", "lts" : { "is_lts_enabled" : true, "log_group_name" : "CTS", "log_topic_name" : "system-trace" }, "log_file_validate" : { "is_support_validate" : true }, "tracker_name" : "system", "tracker_type" : "system", "status" : "enabled" }
Status Codes
Status Code |
Description |
---|---|
201 |
The request is successful. |
400 |
The server failed to process the request. |
401 |
The request is rejected due to authentication failure. |
403 |
The server understood the request but refused to authorize it. |
404 |
The requested resource 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