Querying Log Ingestion Configurations

Function

This API is used to query log ingestion configurations in LTS.

URI

POST /v3/{project_id}/lts/access-config-list

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 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_name_list

Yes

Array of strings

List of ingestion configuration names.

Minimum: 1

Maximum: 64

host_group_name_list

Yes

Array of strings

List of host group names.

Minimum: 1

Maximum: 64

log_group_name_list

Yes

Array of strings

List of log group names.

Minimum: 1

Maximum: 64

log_stream_name_list

Yes

Array of strings

List of log stream names.

Minimum: 1

Maximum: 64

access_config_tag_list

No

Array of accessConfigTag objects

Ingestion configuration tags. A tag key must be unique. Up to 20 tags are allowed.

Table 4 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 5 Response body parameters

Parameter

Type

Description

result

Array of AccessConfigInfo objects

Ingestion configuration list.

total

Long

Total number of ingestion configurations.

Table 6 AccessConfigInfo

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 7 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 8 AccessConfigFormatCreate

Parameter

Type

Description

single

AccessConfigFormatSingleCreate object

Single-line logs.

multi

AccessConfigFormatMutilCreate object

Multi-line logs.

Table 9 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 10 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 11 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 12 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 13 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 14 AccessConfigHostGroupIdList

Parameter

Type

Description

host_group_id_list

Array of strings

List of host group IDs.

Table 15 accessConfigTagResponse

Parameter

Type

Description

key

String

Tag key.

value

String

Tag value.

Status code: 400

Table 16 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error description

Status code: 500

Table 17 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error description

Example Requests

Log ingestion configurations are filtered by the request body.

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

{
  "access_config_name_list" : [ "Collectionxx2", "22x", "2x", "CollectionWjxxxx" ],
  "host_group_name_list" : [ "wwxx" ],
  "log_group_name_list" : [ "lts-grxx", "lts-xx", "lts-gxx" ],
  "log_stream_name_list" : [ "lts-topixx", "lts-txx" ],
  "access_config_tag_list" : [ {
    "key" : "xxx",
    "value" : "xxx"
  }, {
    "key" : "xxx1",
    "value" : "xxx1"
  } ]
}

Example Responses

Status code: 200

The query is successful.

{
  "result" : [ {
    "access_config_detail" : {
      "containerNameRegex" : "my",
      "excludeEnvs" : {
        "h" : "8"
      },
      "excludeK8sLabels" : {
        "e" : "5"
      },
      "excludeLabels" : {
        "b" : "2"
      },
      "format" : {
        "single" : {
          "mode" : "system",
          "value" : "1678969382000"
        }
      },
      "includeEnvs" : {
        "g" : "7"
      },
      "includeK8sLabels" : {
        "d30" : "4"
      },
      "includeLabels" : {
        "a" : "1"
      },
      "logEnvs" : {
        "i" : "9"
      },
      "logK8s" : {
        "f" : "6"
      },
      "logLabels" : {
        "c" : "3"
      },
      "namespaceRegex" : "default",
      "pathType" : "container_stdout",
      "paths" : [ ],
      "podNameRegex" : "abc",
      "stderr" : false,
      "stdout" : true
    },
    "access_config_id" : "c3152f88-8b06-4f7f-bbbe-129512f49f87",
    "access_config_name" : "myapinew322",
    "access_config_tag" : [ {
      "key" : "my01",
      "value" : "001"
    }, {
      "key" : "my02",
      "value" : "002"
    } ],
    "access_config_type" : "K8S_CCE",
    "binary_collect" : false,
    "create_time" : 1684467787996,
    "host_group_info" : {
      "host_group_id_list" : [ "12b0bbd1-4eda-456b-a641-647aa66bdeab" ]
    },
    "log_info" : {
      "log_group_id" : "9575cb24-290c-478e-a5db-88d6d1dc513b",
      "log_group_name" : "my-group",
      "log_stream_id" : "3581bee9-8698-476e-a0ba-b0f310ed99cf",
      "log_stream_name" : "lts-topic-api"
    },
    "log_split" : false
  }, {
    "access_config_detail" : {
      "containerNameRegex" : "my",
      "excludeEnvs" : {
        "h" : "8"
      },
      "excludeK8sLabels" : {
        "e" : "5"
      },
      "excludeLabels" : {
        "b" : "2"
      },
      "format" : {
        "single" : {
          "mode" : "system",
          "value" : "1678969382000"
        }
      },
      "includeEnvs" : {
        "g" : "7"
      },
      "includeK8sLabels" : {
        "d10" : "4",
        "d" : "4",
        "d12" : "4",
        "d11" : "4",
        "d14" : "4",
        "d13" : "4",
        "d16" : "4",
        "d15" : "4",
        "d18" : "4",
        "d17" : "4",
        "d1" : "4",
        "d2" : "4",
        "d3" : "4",
        "d4" : "4",
        "d5" : "4",
        "d6" : "4",
        "d7" : "4",
        "d8" : "4",
        "d9" : "4"
      },
      "includeLabels" : {
        "a" : "1"
      },
      "logEnvs" : {
        "i" : "9"
      },
      "logK8s" : {
        "f" : "6"
      },
      "logLabels" : {
        "c" : "3"
      },
      "namespaceRegex" : "default",
      "pathType" : "container_stdout",
      "paths" : [ ],
      "podNameRegex" : "abc",
      "stderr" : false,
      "stdout" : true
    },
    "access_config_id" : "550cd738-7b16-4724-9c59-aba61bf16528",
    "access_config_name" : "myapinew32",
    "access_config_tag" : [ {
      "key" : "my01",
      "value" : "001"
    }, {
      "key" : "my02",
      "value" : "002"
    } ],
    "access_config_type" : "K8S_CCE",
    "binary_collect" : false,
    "create_time" : 1684463134956,
    "host_group_info" : {
      "host_group_id_list" : [ "12b0bbd1-4eda-456b-a641-647aa66bdeab" ]
    },
    "log_info" : {
      "log_group_id" : "9575cb24-290c-478e-a5db-88d6d1dc513b",
      "log_group_name" : "my-group",
      "log_group_name_alias" : "my-group",
      "log_stream_id" : "3581bee9-8698-476e-a0ba-b0f310ed99cf",
      "log_stream_name" : "lts-topic-api",
      "log_stream_name_alias" : "lts-topic-api"
    },
    "log_split" : false
  } ],
  "total" : 2
}

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 name"
}

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

The query is successful.

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.