Modifying a Log Ingestion Configuration

Function

This API is usde to modify a log ingestion configuration.

URI

PUT /v3/{project_id}/lts/access-config

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain a project ID, see Obtaining the Account Tenant ID, Project Resource Set ID, Log Group ID, and Log Stream ID.

Minimum: 32

Maximum: 32

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM. For details about how to obtain a user token, see Obtaining a User Token.

Minimum: 1000

Maximum: 2000

Content-Type

Yes

String

Set this parameter to application/json;charset=UTF-8.

Minimum: 30

Maximum: 30

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

access_config_id

Yes

String

Ingestion configuration ID.

Minimum: 36

Maximum: 36

access_config_detail

No

AccessConfigDeatilUpdate object

Ingestion configuration details.

host_group_info

No

AccessConfigHostGroupIdList object

Host group ID list.

access_config_tag

No

Array of accessConfigTag objects

Tag information.

log_split

No

Boolean

Log splitting.

binary_collect

No

Boolean

Binary collection.

cluster_id

No

String

CCE cluster ID. This parameter is mandatory for the CCE type.

Table 4 AccessConfigDeatilUpdate

Parameter

Mandatory

Type

Description

paths

No

Array of strings

Log collection paths.

Minimum: 1

Maximum: 128

black_paths

No

Array of strings

Log collection blacklist paths.

Minimum: 1

Maximum: 128

format

No

AccessConfigFormatUpdate object

Log format.

windows_log_info

No

AccessConfigWindowsLogInfoUpdate object

Windows event logs. To stop collecting Windows event logs, leave this parameter to empty.

stdout

No

Boolean

Standard output switch. This parameter is used only when the CCE ingestion type is used.

stderr

No

Boolean

Standard output error switch. This parameter is used only when the CCE ingestion type is used.

pathType

No

String

CCE ingestion type. This parameter is used only when the CCE ingestion type is used.

namespaceRegex

No

String

Regular expression matching of Kubernetes namespaces. This parameter is used only when the CCE ingestion type is used.

podNameRegex

No

String

Regular expression matching of the Kubernetes container name. This parameter is used only when the CCE ingestion type is used.

containerNameRegex

No

String

Regular expression matching of the Kubernetes container name. This parameter is used only when the CCE ingestion type is used.

includeLabels

No

Map<String,String>

Container label whitelist. A maximum of 30 container labels can be created. The key names must be unique. This parameter is used only when the access type is CCE.

excludeLabels

No

Map<String,String>

Container label blacklist. A maximum of 30 container labels can be created. The key names must be unique. This parameter is used only when the CCE access type is used.

includeEnvs

No

Map<String,String>

Environment variable whitelist. A maximum of 30 environment variable whitelists can be created. Key names must be unique. This parameter is used only when the access type is CCE.

excludeEnvs

No

Map<String,String>

Environment variable blacklist. A maximum of 30 environment variables can be created. The key names must be unique. This parameter is used only when the CCE access type is used.

logLabels

No

Map<String,String>

Environment variable log tag. A maximum of 30 tags can be created. The key name must be unique. This parameter is used only when the access type is CCE.

logEnvs

No

Map<String,String>

Environment variable log tag. A maximum of 30 tags can be created. The key name must be unique. This parameter is used only when the access type is CCE.

includeK8sLabels

No

Map<String,String>

Specifies the Kubernetes label whitelist. A maximum of 30 Kubernetes label whitelists can be created. The key names must be unique. This parameter is used only when the access type is CCE.

excludeK8sLabels

No

Map<String,String>

Specifies the Kubernetes label blacklist. A maximum of 30 Kubernetes label blacklists can be created. The key names must be unique. This parameter is used only when the CCE access type is used.

logK8s

No

Map<String,String>

Specifies the Kubernetes label. A maximum of 30 Kubernetes labels can be created. The key names must be unique. This parameter is used only when the access type is CCE.

Table 5 AccessConfigFormatUpdate

Parameter

Mandatory

Type

Description

single

No

AccessConfigFormatSingle object

Single-line logs.

multi

No

AccessConfigFormatMutil object

Multi-line logs.

Table 6 AccessConfigFormatSingle

Parameter

Mandatory

Type

Description

mode

Yes

String

Single-line logs. system indicates the system time, whereas wildcard indicates the time wildcard.

value

Yes

String

Log time.If mode is system, the value is the current timestamp.If mode is wildcard, the value is a time wildcard, which is used to match the log printing time displayed at the beginning of a log event. If the time format in a log event is 2019-01-01 23:59:59, the time wildcard is YYYY-MM-DD hh:mm:ss. If the time format in a log event is 19-1-1 23:59:59, the time wildcard is YY-M-D hh:mm:ss.

Minimum: 1

Maximum: 64

Table 7 AccessConfigFormatMutil

Parameter

Mandatory

Type

Description

mode

Yes

String

Single-line logs. time indicates a time wildcard is used to detect log boundaries, whereas regular indicates that a regular expression is used.

value

Yes

String

Log time.If mode is regular, the value is a regular expression.If mode is time, the value is a time wildcard, which is used by ICAgent to look for the log printing time as the beginning of a log event. If the time format in a log event is 2019-01-01 23:59:59, the time wildcard is YYYY-MM-DD hh:mm:ss. If the time format in a log event is 19-1-1 23:59:59, the time wildcard is YY-M-D hh:mm:ss.

Minimum: 1

Maximum: 64

Table 8 AccessConfigWindowsLogInfoUpdate

Parameter

Mandatory

Type

Description

categorys

No

Array of strings

The type of Windows event logs to be collected. Application: application system; System: system; Security: security; Setup: startup

time_offset

No

AccessConfigTimeOffset object

Time offset.

event_level

No

Array of strings

Event level.

  • information: common information events, which do not affect system running.

  • warning: warning events, which may affect system running but do not cause system breakdown.

  • error: error events, which cause system breakdown or prevent the service from running properly.

  • critical: critical events, which may cause system or application failures.

  • verbose: detailed event information, which does not affect the system running.

Table 9 AccessConfigTimeOffset

Parameter

Mandatory

Type

Description

offset

Yes

Long

Time offset.

When unit is day, the value ranges from 1 to 7.

When unit is hour, the value ranges from 1 to 168.

When unit is sec, the value ranges from 1 to 604800.

unit

Yes

String

Unit of the time offset.

  • day

  • hour

  • sec

Table 10 AccessConfigHostGroupIdList

Parameter

Mandatory

Type

Description

host_group_id_list

Yes

Array of strings

List of host group IDs.

Table 11 accessConfigTag

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key. Use only UTF-8 letters, digits, spaces, and the following characters: .:=+-@. Do not start with an underscore (). Max 128 characters are allowed.

value

No

String

Tag value. Use only UTF-8 letters, digits, spaces, and the following characters: _.:/=+-@. Max 255 characters are allowed.

Response Parameters

Status code: 200

Table 12 Response body parameters

Parameter

Type

Description

access_config_id

String

Ingestion configuration ID.

access_config_name

String

Ingestion configuration name.

access_config_type

String

Ingestion configuration type. The value AGENT indicates host log ingestion.

create_time

Long

Creation time.

access_config_detail

AccessConfigDeatilResponse object

Ingestion configuration details.

log_info

AccessConfigQueryLogInfo object

Log details.

host_group_info

AccessConfigHostGroupIdList object

Host group ID list.

access_config_tag

Array of accessConfigTagResponse objects

Tag information.

log_split

Boolean

Log splitting.

binary_collect

Boolean

Binary collection.

cluster_id

String

CCE cluster ID

Table 13 AccessConfigDeatilResponse

Parameter

Type

Description

paths

Array of strings

Collection paths.

black_paths

Array of strings

Collection path blacklist.

format

AccessConfigFormatCreate object

Log format.

windows_log_info

AccessConfigWindowsLogInfoCreate object

Windows event logs.

stdout

Boolean

Standard output switch. This parameter is used only for CCE log ingestion.

stderr

Boolean

Standard error switch. This parameter is used only for CCE log ingestion.

pathType

String

CCE log ingestion type. This parameter is used only for CCE log ingestion.

namespaceRegex

String

Regular expression matching of Kubernetes namespaces. This parameter is used only for CCE log ingestion.

podNameRegex

String

Regular expression matching of Kubernetes pods. This parameter is used only for CCE log ingestion.

containerNameRegex

String

Regular expression matching of Kubernetes container names. This parameter is used only for CCE log ingestion.

includeLabels

Map<String,String>

Container label whitelist. You can create up to 30 whitelists. The key names must be unique. This parameter is used only for CCE log ingestion.

excludeLabels

Map<String,String>

Container label blacklist. You can create up to 30 blacklists. The key names must be unique. This parameter is used only for CCE log ingestion.

includeEnvs

Map<String,String>

Environment variable whitelist. You can create up to 30 whitelists. The key names must be unique. This parameter is used only for CCE log ingestion.

excludeEnvs

Map<String,String>

Environment variable blacklist. You can create up to 30 blacklists. The key names must be unique. This parameter is used only for CCE log ingestion.

logLabels

Map<String,String>

Container label. You can create up to 30 labels. The key names must be unique. This parameter is used only for CCE log ingestion.

logEnvs

Map<String,String>

Environment variable label. You can create up to 30 labels. The key names must be unique. This parameter is used only for CCE log ingestion.

includeK8sLabels

Map<String,String>

Kubernetes label whitelist. You can create up to 30 whitelists. The key names must be unique. This parameter is used only for CCE log ingestion.

excludeK8sLabels

Map<String,String>

Kubernetes label blacklist. You can create up to 30 blacklists. The key names must be unique. This parameter is used only for CCE log ingestion.

logK8s

Map<String,String>

Kubernetes label. You can create up to 30 labels. The key names must be unique. This parameter is used only for CCE log ingestion.

Table 14 AccessConfigFormatCreate

Parameter

Type

Description

single

AccessConfigFormatSingleCreate object

Single-line logs.

multi

AccessConfigFormatMutilCreate object

Multi-line logs.

Table 15 AccessConfigFormatSingleCreate

Parameter

Type

Description

mode

String

Single-line logs. system indicates the system time, whereas wildcard indicates the time wildcard.

value

String

Log time.If mode is system, the value is the current timestamp.If mode is wildcard, the value is a time wildcard, which is used by ICAgent to look for the log printing time as the beginning of a log event. If the time format in a log event is 2019-01-01 23:59:59, the time wildcard is YYYY-MM-DD hh:mm:ss. If the time format in a log event is 19-1-1 23:59:59, the time wildcard is YY-M-D hh:mm:ss.

Table 16 AccessConfigFormatMutilCreate

Parameter

Type

Description

mode

String

Single-line logs. time indicates a time wildcard is used to detect log boundaries, whereas regular indicates that a regular expression is used.

value

String

Log time.If mode is regular, the value is a regular expression.If mode is time, the value is a time wildcard, which is used by ICAgent to look for the log printing time as the beginning of a log event. If the time format in a log event is 2019-01-01 23:59:59, the time wildcard is YYYY-MM-DD hh:mm:ss. If the time format in a log event is 19-1-1 23:59:59, the time wildcard is YY-M-D hh:mm:ss.

Table 17 AccessConfigWindowsLogInfoCreate

Parameter

Type

Description

categorys

Array of strings

Type of Windows event logs to be collected.

  • Application: application event logs.

  • System: system event logs.

  • Security: security event logs.

  • Setup: startup event logs.

time_offset

AccessConfigTimeOffset object

Offset from first collection time.

event_level

Array of strings

Event level.

  • information: common information events, which do not affect system running.

  • warning: warning events, which may affect system running but do not cause system breakdown.

  • error: error events, which cause system breakdown or prevent the service from running properly.

  • critical: critical events, which may cause system or application failures.

  • verbose: detailed event information, which does not affect the system running.

Table 18 AccessConfigTimeOffset

Parameter

Type

Description

offset

Long

Time offset.

When unit is day, the value ranges from 1 to 7.

When unit is hour, the value ranges from 1 to 168.

When unit is sec, the value ranges from 1 to 604800.

unit

String

Unit of the time offset.

  • day

  • hour

  • sec

Table 19 AccessConfigQueryLogInfo

Parameter

Type

Description

log_group_id

String

Log group ID.

log_stream_id

String

Log stream ID.

log_group_name

String

Log group name.

log_stream_name

String

Log stream name.

log_group_name_alias

String

Log group alias.

log_stream_name_alias

String

Log stream alias.

Table 20 AccessConfigHostGroupIdList

Parameter

Type

Description

host_group_id_list

Array of strings

List of host group IDs.

Table 21 accessConfigTagResponse

Parameter

Type

Description

key

String

Tag key.

value

String

Tag value.

Status code: 400

Table 22 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error description

Status code: 500

Table 23 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error description

Example Requests

Modifying a Log Ingestion Configuration (for ECS)

PUT https://{endpoint}/v3/{project_id}/lts/access-config

{
  "access_config_id" : "ed90802a-8475-4702-955e-e3ee16a5dde9",
  "access_config_detail" : {
    "paths" : [ "/test/222", "/test/111" ],
    "black_paths" : [ ],
    "format" : {
      "multi" : {
        "mode" : "regular",
        "value" : "aaaa"
      }
    },
    "windows_log_info" : {
      "categorys" : [ "Application", "System" ],
      "time_offset" : {
        "offset" : 7,
        "unit" : "day"
      },
      "event_level" : [ "information", "warning", "error", "critical", "verbose" ]
    }
  },
  "host_group_info" : {
    "host_group_id_list" : [ "de4dbed4-a3bc-4877-a7ee-096a2a63e036" ]
  },
  "access_config_tag" : [ {
    "key" : "xxx",
    "value" : "xxx"
  }, {
    "key" : "xxx1",
    "value" : "xxx1"
  } ]
}

Example Responses

Status code: 200

Ingestion configuration modified.

{
  "access_config_detail" : {
    "black_paths" : [ "/wjy/hei/tesxxx", "/wjy/hei/tesxxx" ],
    "format" : {
      "single" : {
        "mode" : "wildcard",
        "value" : "1111"
      }
    },
    "paths" : [ "/wjy/tesxxx" ],
    "windows_log_info" : {
      "categorys" : [ "System", "Application", "Security", "Setup" ],
      "event_level" : [ "information", "warning", "error", "critical", "verbose" ],
      "time_offset" : {
        "offset" : 168,
        "unit" : "hour"
      }
    }
  },
  "access_config_id" : "aa58d29e-21a9-4761-ba16-8cxxxxd",
  "access_config_name" : "CollectionWjy_xxxxt2",
  "access_config_tag" : [ {
    "key" : "xxx",
    "value" : "xxx"
  }, {
    "key" : "xxx1",
    "value" : "xxx1"
  } ],
  "access_config_type" : "AGENT",
  "create_time" : 163504332654,
  "host_group_info" : {
    "host_group_id_list" : [ "de4dbed4-a3bc-4877-a7ee-09xxxxxx" ]
  },
  "log_info" : {
    "log_group_id" : "9a7e2183-2d6d-4732-9axxxxx49e0",
    "log_group_name" : "lts-groupxxxa",
    "log_group_name_alias" : "lts-groupxxxa",
    "log_stream_id" : "c4de0538-53e6-41fd-b951-xxxx8d7",
    "log_stream_name" : "lts-topixxx",
    "log_stream_name_alias" : "lts-topixxx"
  }
}

Status code: 400

Invalid request. Modify the request based on the description in error_msg before a retry.

{
  "error_code" : "LTS.1807",
  "error_msg" : "Invalid access config id"
}

Status code: 500

The server has received the request but encountered an internal error.

{
  "error_code" : "LTS.0010",
  "error_msg" : "The system encountered an internal error"
}

Status Codes

Status Code

Description

200

Ingestion configuration modified.

400

Invalid request. Modify the request based on the description in error_msg before a retry.

500

The server has received the request but encountered an internal error.

Error Codes

See Error Codes.