Updated on 2024-06-19 GMT+08:00

Creating a Tracker

Function

When you enable 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 can be created by an account in a region. Traces are retained in the CTS console for seven days. For long-term storage, you can enable Object Storage Service (OBS) and deliver real-time operation records to OBS buckets.

URI

POST /v3/{project_id}/tracker

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining an Account ID and Project ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

tracker_type

Yes

String

Tracker type. The value can be system (management tracker).

Enumerated values:

  • system

tracker_name

Yes

String

Tracker name. When tracker_type is set to system, the default value system is used.

is_lts_enabled

No

Boolean

Whether to enable trace analysis.

obs_info

No

TrackerObsInfo object

Configurations of an OBS bucket to which traces will be transferred.

Table 3 TrackerObsInfo

Parameter

Mandatory

Type

Description

bucket_name

No

String

OBS bucket name. 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

Prefix of trace files that need to be stored in OBS buckets. The value can contain 0 to 64 characters, including letters, digits, hyphens (-), underscores (_), and periods (.).

is_obs_created

No

Boolean

Whether an OBS bucket is created. If the value is true, an OBS bucket will be created to store trace files. If the value is false, trace files will be stored in an existing OBS bucket.

Response Parameters

Status code: 201

Table 4 Response body parameters

Parameter

Type

Description

id

String

Unique tracker ID.

create_time

Long

Timestamp when the tracker was created.

lts

Lts object

Detail about trace analysis.

tracker_type

String

Tracker type. The value can be system (management tracker).

Enumerated values:

  • system

domain_id

String

Account ID. For details, see Obtaining an Account ID and Project ID.

project_id

String

Project ID.

tracker_name

String

Tracker name. The default value is system.

status

String

Tracker status. The value can be enabled, disabled, or error. If the value is set to error, the detail field is required for specifying the source of the error.

Enumerated values:

  • enabled
  • disabled

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.

obs_info

ObsInfo object

Information about the bucket to which traces are transferred.

Table 5 ManagementEventSelector

Parameter

Type

Description

exclude_service

Array of strings

Cloud services whose traces will not be transferred. Currently, the value can only be set to KMS, indicating that the createDatakey traces of KMS will not be transferred.

Table 6 Lts

Parameter

Type

Description

is_lts_enabled

Boolean

Specifies whether to enable the LTS search function.

log_group_name

String

Name of the log group that CTS creates in LTS.

log_topic_name

String

Specifies the name of the log topic that CTS creates in LTS.

Table 7 ObsInfo

Parameter

Type

Description

bucket_name

String

OBS bucket name. 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

Prefix of trace files that need to be stored in OBS buckets. The value can contain 0 to 64 characters, including letters, digits, hyphens (-), underscores (_), and periods (.).

is_obs_created

Boolean

Whether the OBS bucket is automatically created by the tracker.

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code. Format: CTS.XXX.

error_msg

String

Error message.

Status code: 401

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code. Format: CTS.XXX.

error_msg

String

Error message.

Status code: 403

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code. Format: CTS.XXX.

error_msg

String

Error message.

Status code: 404

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code. Format: CTS.XXX.

error_msg

String

Error message.

Status code: 500

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code. Format: CTS.XXX.

error_msg

String

Error message.

Status code: 503

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Error code. Format: CTS.XXX.

error_msg

String

Error message.

Example Request

  • 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 Response

Status code: 201

The request is successful.

{
  "id" : "2e6fa9b8-8c6e-456d-b5d3-77be972d220b",
  "create_time" : 1587958482923,
  "domain_id" : "aexxxxxxxx4d4fb4bexxxxxxx791fbf",
  "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"
  },
  "is_support_validate" : true,
  "tracker_name" : "system",
  "tracker_type" : "system",
  "status" : "enabled"
}

Status Code

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

Failed to complete the request because of an internal service error.

503

The requested service is invalid. The client should not repeat the request without modifications.

Error Code

For details, see Error Codes.