Updated on 2022-02-22 GMT+08:00

Modifying a Tracker

Function

This API is used to modify configurations of a tracker, including trace transfer to OBS buckets, key event notifications, trace file encryption, management trace retrieval using Log Tank Service (LTS), trace file integrity check, and tracker enablement or disablement. Modifying tracker parameters does not affect the collected operation records. After the modification is complete, the new rules are immediately applied to operation recording.

URI

PUT /v3/{project_id}/tracker

Table 1 Path parameters

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

Table 2 Request body 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:

  • system

  • data

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.

status

No

String

Indicates the status of a tracker. The value can be enabled or disabled. If you change the value to disabled, the tracker stops recording traces.

Enumeration values:

  • enabled

  • disabled

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 are 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 configurations of a tracked OBS bucket. This parameter is valid when tracker_type is set to data.

Table 3 TrackerObsInfo

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:

  • 30

  • 60

  • 90

  • 180

  • 1095

Table 4 DataBucket

Parameter

Mandatory

Type

Description

data_bucket_name

No

String

Indicates the name of the bucket tracked by a data tracker.

  • This parameter is mandatory when the data tracker is enabled or disabled.

  • This parameter is unavailable for a management tracker.

  • Once a tracker is created, the bucket that it tracks cannot be switched.

data_event

No

Array of strings

Indicates the type of operations tracked by a data tracker.

  • This parameter is mandatory when the data tracker is enabled or disabled.

  • This parameter is unavailable for a management tracker.

Enumeration values:

  • WRITE

  • READ

Response Parameters

If a status code 400is returned, see the parameters in the following tables.

Table 5 Response body parameters

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 modifying a management tracker

    PUT 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" : false,
      "is_support_trace_files_encryption" : false,
      "kms_id" : "",
      "is_support_validate" : false,
      "status" : "enabled"
    }
  • Example request for modifying a data tracker

    {
      "tracker_type" : "data",
      "tracker_name" : "data-tracker-name",
      "obs_info" : {
        "is_obs_created" : false,
        "bucket_name" : "",
        "file_prefix_name" : "",
        "bucket_lifecycle" : 60
      },
      "is_lts_enabled" : true,
      "data_bucket" : {
        "data_event" : [ "READ", "WRITE" ]
      }
    }

Response Examples

None

Status Codes

Status Code

Description

200

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 server failed to find the requested resource.

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.