El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Cloud Data Center
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Domain Name Service
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
DataArts Fabric
Cloud Transformation
Cloud Adoption Framework
Well-Architected Framework
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
MacroVerse aPaaS
CloudDevice
KooDrive
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance (CCI)
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Meeting
IoT
IoT Device Access
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Industry Video Management Service
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
Huawei Cloud Astro Canvas
Huawei Cloud Astro Zero
CodeArts Governance
Help Center/ Log Tank Service/ API Reference/ APIs/ Log Ingestion/ Creating a Log Ingestion Configuration

Creating a Log Ingestion Configuration

Function

This API is used to create a log ingestion configuration.

Calling Method

For details, see Calling APIs.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. It can be obtained by calling an API or from the console. For details, see Obtaining a Project ID.

Constraints

N/A

Range

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

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

Constraints

N/A

Range

N/A

Default Value

N/A

Content-Type

Yes

String

Definition

Message body format. Set this parameter to application/json;charset=utf8.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

access_config_name

Yes

String

Definition

Log ingestion configuration name.

Range

N/A

access_config_type

Yes

String

Definition

Log ingestion configuration type.

Range

  • AGENT: ECS text log ingestion.

  • K8S_CCE: CCE application log ingestion.

access_config_detail

Yes

AccessConfigDeatilCreate object

Definition

Log ingestion configuration details.

log_info

Yes

AccessConfigBaseLogInfoCreate object

Definition

Log stream details of the log ingestion configuration.

host_group_info

No

AccessConfigHostGroupIdListCreate object

Definition

Host group ID list of the log ingestion configuration.

access_config_tag

No

Array of accessConfigTag objects

Definition

Label information of the log ingestion configuration.

binary_collect

No

Boolean

Definition

Whether to collect binary data.

Range

  • true: collects binary data.

  • false: does not collect binary data.

log_split

No

Boolean

Definition

Whether to split logs.

Range

  • true: splits logs.

  • false: does not split logs.

cluster_id

No

String

Definition

CCE cluster ID.

Range

N/A

incremental_collect

No

Boolean

Definition

Whether to enable incremental collection.

Range

true: collects new log data.

false: collects all log data.

encoding_format

No

String

Definition

Encoding format. The default format is UTF-8.

Range

N/A

processor_type

No

String

Definition

ICAgent structuring parsing type.

Range

  • SINGLE_LINE

  • MULTI_LINE

  • REGEX

  • MULTI_REGEX

  • SPLIT

  • JSON

  • NGINX

  • COMPOSE

  • ORC

demo_log

No

String

Definition

Sample log event.

Range

N/A

demo_fields

No

Array of DemoFieldAccess objects

Definition

Parsing fields of the sample log event.

processors

No

Array of Processor objects

Definition

ICAgent structuring parser.

application_id

No

String

Definition

ServiceStage application ID.

Range

N/A

environment_id

No

String

Definition

ServiceStage environment ID.

Range

N/A

component_id

No

Array of strings

Definition

ServiceStage component ID list.

access_config_type_source

No

String

Definition

Self-built software source of log ingestion.

Range

  • ECS

  • CCE

  • BMS

  • K8S

  • ServiceStageHost

  • ServiceStage

recursive_depth

No

Integer

Definition

Maximum recursion depth of a collection path.

Range

N/A

Table 4 AccessConfigDeatilCreate

Parameter

Mandatory

Type

Description

paths

No

Array of strings

Definition

Collection paths.

  • A path must start with a slash (/) or a letter followed by a colon and a backslash (for example, C:\).

  • A path cannot contain only slashes (/). The following special characters are not allowed: <>'|"

  • A path cannot start with /** or /*.

  • Only one double asterisk (**) can be contained in a path.

  • The container path and host path are mandatory for the CCE type and are not mandatory for the standard output.

black_paths

No

Array of strings

Definition

Collection blacklist paths.

  • A path must start with a slash (/) or a letter followed by a colon and a backslash (for example, C:\).

  • A path cannot contain only slashes (/). The following special characters are not allowed: <>'|"

  • A path cannot start with /** or /*.

  • Only one double asterisk (**) can be contained in a path.

format

Yes

AccessConfigFormatCreate object

Definition

Log format information.

windows_log_info

No

AccessConfigWindowsLogInfoCreate object

Definition

Windows event log information in a log ingestion configuration.

stdout

No

Boolean

Definition

Whether to enable container standard output collection in a CCE application log ingestion configuration.

Range

  • true: Container standard output collection is enabled.

  • false: Container standard output collection is disabled.

stderr

No

Boolean

Definition

Whether to enable container standard error collection in a CCE application log ingestion configuration.

Range

  • true: Container standard error collection is enabled.

  • false: Container standard error collection is disabled.

pathType

No

String

Definition

Data source type. This parameter is available only for CCE application log ingestion.

Range

  • HOST_FILE: node file type

  • CONTAINER_STDOUT: container standard output

  • CONTAINER_FILE: container file path

  • K8S_EVENT: Kubernetes event

namespaceRegex

No

String

Definition

Regular expression used to match Kubernetes namespaces by name. LTS will collect logs from containers within those matched namespaces. To collect logs of all namespaces, leave this parameter empty.

This parameter is available only for CCE application log ingestion.

Range

N/A

podNameRegex

No

String

Definition

Regular expression used to match Kubernetes pods by name. LTS will collect logs from containers within those matched pods. To collect logs of all pods, leave this parameter empty.

This parameter is available only for CCE application log ingestion.

Range

N/A

containerNameRegex

No

String

Definition

Regular expression used to match Kubernetes containers by name. Kubernetes container names are defined in spec.containers. LTS will collect logs from those matched containers. To collect logs of all containers, leave this parameter empty.

This parameter is available only for CCE application log ingestion.

Range

N/A

includeLabels

No

Map<String,String>

Definition

Container label whitelist. When configuring CCE application log ingestion, you can specify containers whose logs are to be collected by adding container label whitelists in the format of LabelKey:LabelValue. You can add up to 30 LabelKey:LabelValue pairs.

  • LabelKey: mandatory. It cannot start with a period (.) and can contain a maximum of 128 characters.

  • LabelValue: It can be left blank and can contain a maximum of 512 characters.

If LabelValue is empty, all containers with the specified LabelKey in their container labels are matched. If LabelValue is not empty, only containers with LabelKey=LabelValue in their container labels are matched. LabelKey must be exactly matched, while LabelValue supports regular expression matching.

excludeLabels

No

Map<String,String>

Definition

Container label blacklist. When configuring CCE application log ingestion, you can specify containers whose logs are not to be collected by adding container label blacklists in the format of LabelKey:LabelValue. You can add up to 30 LabelKey:LabelValue pairs.

  • LabelKey: mandatory. It cannot start with a period (.) and can contain a maximum of 128 characters.

  • LabelValue: It can be left blank and can contain a maximum of 512 characters.

If LabelValue is empty, all containers with the specified LabelKey in their container labels are excluded. If LabelValue is not empty, only containers with LabelKey=LabelValue in their container labels are excluded. LabelKey must be exactly matched, while LabelValue supports regular expression matching.

includeEnvs

No

Map<String,String>

Definition

Environment variable whitelist. When configuring CCE application log ingestion, you can specify containers whose logs are to be collected by adding environment variable whitelists in the format of LabelKey:LabelValue. You can add up to 30 LabelKey:LabelValue pairs.

  • LabelKey: mandatory. It cannot start with a period (.) and can contain a maximum of 128 characters.

  • LabelValue: It can be left blank and can contain a maximum of 512 characters.

If LabelValue is empty, all containers with the specified LabelKey in their environment variables are matched. If LabelValue is not empty, only containers with LabelKey=LabelValue in their environment variables are matched. LabelKey must be exactly matched, while LabelValue supports regular expression matching.

excludeEnvs

No

Map<String,String>

Definition

Environment variable blacklist. When configuring CCE application log ingestion, you can specify containers whose logs are not to be collected by adding environment variable blacklists in the format of LabelKey:LabelValue. You can add up to 30 LabelKey:LabelValue pairs.

  • LabelKey: mandatory. It cannot start with a period (.) and can contain a maximum of 128 characters.

  • LabelValue: It can be left blank and can contain a maximum of 512 characters.

If LabelValue is empty, all containers with the specified LabelKey in their environment variables are excluded. If LabelValue is not empty, only containers with LabelKey=LabelValue in their environment variables are excluded. LabelKey must be exactly matched, while LabelValue supports regular expression matching.

logLabels

No

Map<String,String>

Definition

Container label. When configuring CCE application log ingestion, you can use this parameter to add container label fields to logs. For example, if you set app as the LabelKey and app_alias as the LabelValue, when a container's labels contain app=lts, the field {app_alias:lts} will be added to the logs of that container.

logEnvs

No

Map<String,String>

Definition

Environment variable. When configuring CCE application log ingestion, you can use this parameter to add environment variable fields to logs. For example, if you set app as the environment variable key and app_alias as the value, when the Kubernetes environment variables contain app=lts, {app_alias:lts} will be added to the Kubernetes logs.

includeK8sLabels

No

Map<String,String>

Definition

Kubernetes label whitelist. When configuring CCE application log ingestion, you can specify containers whose logs are to be collected by adding Kubernetes label whitelists in the format of LabelKey:LabelValue. You can add up to 30 LabelKey:LabelValue pairs.

  • LabelKey: mandatory. It cannot start with a period (.) and can contain a maximum of 128 characters.

  • LabelValue: It can be left blank and can contain a maximum of 512 characters.

If LabelValue is empty, all containers with the specified LabelKey in their Kubernetes labels are matched. If LabelValue is not empty, only containers with LabelKey=LabelValue in their Kubernetes labels are matched. LabelKey must be exactly matched, while LabelValue supports regular expression matching.

excludeK8sLabels

No

Map<String,String>

Definition

Kubernetes label blacklist. When configuring CCE application log ingestion, you can specify containers whose logs are not to be collected by adding Kubernetes label blacklists in the format of LabelKey:LabelValue. You can add up to 30 LabelKey:LabelValue pairs.

  • LabelKey: mandatory. It cannot start with a period (.) and can contain a maximum of 128 characters.

  • LabelValue: It can be left blank and can contain a maximum of 512 characters.

If LabelValue is empty, all containers with the specified LabelKey in their Kubernetes labels are excluded. If LabelValue is not empty, only containers with LabelKey=LabelValue in their Kubernetes labels are excluded. LabelKey must be exactly matched, while LabelValue supports regular expression matching.

logK8s

No

Map<String,String>

Definition

Kubernetes label. When configuring CCE application log ingestion, you can use this parameter to add Kubernetes label fields to logs. For example, if you set app as the LabelKey and app_alias as the LabelValue, when a container's labels contain app=lts, the field {app_alias:lts} will be added to the logs of that container.

repeat_collect

No

Boolean

Definition

Whether repeated file collection is allowed.

Range

  • true: One host log file can be collected to multiple log streams.

  • false: Each collection path must be unique. That is, the same log file in the same host cannot be collected to different log streams.

system_fields

No

Array of strings

Definition

System built-in fields. When configuring a log ingestion rule, you can specify system fields to include in the tag data of each log reported. If this parameter is modified, the original configuration will be overwritten.

  • The system fields for host log files are hostName, hostId, hostIP, pathFile, hostIPv6, category, collectTime, and __host_group__.

  • The system fields for Kubernetes cluster container log files are hostName, hostId, hostIP, pathFile, hostIPv6, clusterId, podName, appName, containerName, nameSpace, category, collectTime, __host_group__, serviceID, podIp, clusterName, workloadType, and __image_name__.

custom_key_value

No

Map<String,String>

Definition

Custom key-value pairs. When configuring log ingestion, you can configure up to 20 custom key-value pairs to be included as fields in the tag data of each log reported. If this parameter is modified, the original configuration will be overwritten.

  • Key: Enter up to 128 characters, including letters, digits, underscores (_), and hyphens (-).

  • Value: Enter up to 1,024 characters.

includeLabelsLogical

No

String

Definition

Logic for multiple container label whitelists, which determines how the whitelists are applied. The value can be AND (all whitelists must be met) or OR (default value; any whitelist is met).

Range

  • AND

  • OR

excludeLabelsLogical

No

String

Definition

Logic for multiple container label blacklists, which determines how the blacklists are applied. The value can be AND (all blacklists must be met) or OR (default value; any blacklist is met).

Range

  • AND

  • OR

includeK8sLabelsLogical

No

String

Definition

Logic for multiple Kubernetes label whitelists, which determines how the whitelists are applied. The value can be AND (all whitelists must be met) or OR (default value; any whitelist is met).

Range

  • AND

  • OR

excludeK8sLabelsLogical

No

String

Definition

Logic for multiple Kubernetes label blacklists, which determines how the blacklists are applied. The value can be AND (all blacklists must be met) or OR (default value; any blacklist is met).

Range

  • AND

  • OR

includeEnvsLogical

No

String

Definition

Logic for multiple environment variable whitelists, which determines how the whitelists are applied. The value can be AND (all whitelists must be met) or OR (default value; any whitelist is met).

Range

  • AND

  • OR

excludeEnvsLogical

No

String

Definition

Logic for multiple environment variable blacklists, which determines how the blacklists are applied. The value can be AND (all blacklists must be met) or OR (default value; any blacklist is met).

Range

  • AND

  • OR

Table 5 AccessConfigFormatCreate

Parameter

Mandatory

Type

Description

single

No

AccessConfigFormatSingleCreate object

Definition

Single-line log. Each log line is displayed as a separate log event on the LTS console.

multi

No

AccessConfigFormatMutilCreate object

Definition

Multi-line log. Multiple consecutive log lines are displayed as one log event on the LTS console.

Table 6 AccessConfigFormatSingleCreate

Parameter

Mandatory

Type

Description

mode

No

String

Definition

Single-line log collection mode.

Range

  • system: system time

  • wildcard: time wildcard

value

No

String

Definition

Log time.

  • If mode is system, enter the current timestamp for value.

  • If mode is set to wildcard, enter a time wildcard for value. When a time wildcard 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.

Range

N/A

Table 7 AccessConfigFormatMutilCreate

Parameter

Mandatory

Type

Description

mode

No

String

Definition

Multi-line log collection mode.

Range

  • time: log time

  • regular: regular expression mode

value

No

String

Definition

Log time.

  • If mode is system, enter the current timestamp for value.

  • If mode is set to wildcard, enter a time wildcard for value. When a time wildcard 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.

Range

N/A

Table 8 AccessConfigWindowsLogInfoCreate

Parameter

Mandatory

Type

Description

categorys

Yes

Array of strings

Definition

Type of Windows event logs to be collected. There are four types:

  • Application

  • System

  • Security

  • Setup: start

time_offset

Yes

AccessConfigTimeOffset object

Definition

Offset of the first collection time. This parameter is used to correct the time deviation or calculate the relative time. If you set this parameter to 7, logs generated within the seven days before the collection start time are collected. This offset takes effect only for the first collection to ensure that the logs are not repeatedly collected.

event_level

Yes

Array of strings

Definition

Event level. You can filter Windows events based on their levels. This function is available only to Windows Vista or later. There are five levels:

  • information

  • warning

  • error

  • critical

  • verbose

Table 9 AccessConfigTimeOffset

Parameter

Mandatory

Type

Description

offset

Yes

Long

Definition

Time offset.

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

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

  • When unit is sec, the value of offset ranges from 1 to 604,800.

Range

N/A

unit

Yes

String

Definition

Unit of the offset time.

  • day

  • hour

  • sec

Range

N/A

Table 10 AccessConfigBaseLogInfoCreate

Parameter

Mandatory

Type

Description

log_group_id

Yes

String

Definition

Log group ID.

Range

N/A

log_stream_id

Yes

String

Definition

Log stream ID.

Range

N/A

Table 11 AccessConfigHostGroupIdListCreate

Parameter

Mandatory

Type

Description

host_group_id_list

Yes

Array of strings

Definition

Host group ID list.

Table 12 accessConfigTag

Parameter

Mandatory

Type

Description

key

No

String

Definition

Tag key.

Constraints

  • Each tag key must be unique.

  • A tag is a key-value pair. Each key is paired with its corresponding value.

Range

  • A tag key can contain letters, digits, spaces, and special characters (_.:=+-@), but cannot start or end with a space or start with sys.

  • A tag key can contain up to 128 characters.

Default Value

N/A

value

No

String

Definition

Tag value.

Constraints

A tag is a key-value pair. Each key is paired with its corresponding value.

Range

  • A tag value can contain letters, digits, spaces, and special characters (_.:=+-@).

  • A tag value can contain up to 255 characters.

Default Value

N/A

Table 13 DemoFieldAccess

Parameter

Mandatory

Type

Description

field_name

No

String

Definition

Parsing fields of the sample log event.

Range

N/A

field_value

No

String

Definition

Value of a field in a sample log.

Range

N/A

Table 14 Processor

Parameter

Mandatory

Type

Description

type

No

String

Definition

Structuring parsing type. The values are as follows:

  • processor_regex: regular expression

  • processor_split_string: delimiter

  • processor_json: JSON

  • processor_gotime: custom time type

  • processor_filter_regex: log filtering

  • processor_drop: type of fields to be deleted

  • processor_rename: type of fields to be modified

Range

N/A

detail

No

Detail object

Definition

Structuring parsing configuration information.

Table 15 Detail

Parameter

Mandatory

Type

Description

source_key

No

String

Definition

Original field for storing log content before log structuring parsing. The default value is content.

Range

N/A

regex

No

String

Definition

Regular expression. Regular expression used to match logs.

Range

N/A

keys

No

Array of strings

Definition

Name of an extracted field. Set a corresponding field name for the extracted log content.

multi_line_regex

No

String

Definition

First line regular expression.

Range

N/A

keep_source

No

Boolean

Definition

Whether to upload raw logs.

Range

true: retains raw logs.

false: does not retain raw logs.

keep_source_if_parse_error

No

Boolean

Definition

Whether to upload logs that fail to be parsed.

Range

true: uploads logs that fail to be parsed.

false: does not upload logs that fail to be parsed.

split_sep

No

String

Definition

Delimiters. Set delimiters based on the log content, for example, vertical bar (|).

Range

N/A

split_type

No

String

Definition

Delimiter type. The value can be char (single character), special_char (invisible characters), or string.

Range

N/A

fields

No

Map<String,String>

Definition

Field name and value to be added, in the key-value pair format. You can add multiple key-value pairs.

drop_keys

No

Array of strings

Definition

List of discarded fields.

source_keys

No

Array of strings

Definition

Original field to be renamed.

dest_keys

No

Array of strings

Definition

Renamed field.

expand_depth

No

Integer

Definition

Depth of JSON expansion. The default value is 0, indicating that there is no limit. 1 indicates the one level, and so on.

Range

N/A

expand_connector

No

String

Definition

Connector for JSON expansion. The default value is a period (.).

Range

N/A

source_format

No

String

Definition

Format of the original time.

Range

N/A

source_value

No

String

Definition

Field value of the original time.

Range

N/A

set_time

No

Boolean

Definition

Whether to set the parsed time as the log time.

Range

N/A

include

No

Map<String,String>

Definition

Log filtering whitelist rule, in the format of key-value pairs. Each key indicates a log field and must be unique, with a maximum of 256 characters. The corresponding value is a regular expression that specifies the filtering criteria.

exclude

No

Map<String,String>

Definition

Log filtering blacklist rule, in the format of key-value pairs. Each key indicates a log field and must be unique, with a maximum of 256 characters. The corresponding value is a regular expression that specifies the filtering criteria.

Response Parameters

Status code: 200

Table 16 Response body parameters

Parameter

Type

Description

access_config_id

String

Definition

Log ingestion configuration ID.

Range

N/A

access_config_name

String

Definition

Log ingestion configuration name.

Range

N/A

access_config_type

String

Definition

Log ingestion configuration type.

Range

  • AGENT: ECS text log ingestion.

  • K8S_CCE: CCE application log ingestion.

create_time

Long

Definition

Time when the log ingestion configuration was created.

Range

N/A

access_config_detail

AccessConfigDeatilCreate object

Definition

Log ingestion configuration details.

log_info

AccessConfigQueryLogInfo object

Definition

Log stream details of the log ingestion configuration.

host_group_info

AccessConfigHostGroupIdList object

Definition

Host group ID list of the log ingestion configuration.

access_config_tag

Array of accessConfigTagResp objects

Definition

Label information of the log ingestion configuration.

log_split

Boolean

Definition

Whether to split logs.

Range

  • true: splits logs.

  • false: does not split logs.

binary_collect

Boolean

Definition

Whether to collect binary data.

Range

  • true: collects binary data.

  • false: does not collect binary data.

cluster_id

String

Definition

CCE cluster ID.

Range

N/A

encoding_format

String

Definition

Encoding format. The default format is UTF-8.

Range

N/A

incremental_collect

Boolean

Definition

Whether to enable incremental collection.

Range

  • true: collects new log data.

  • false: collects all log data.

processor_type

String

Definition

ICAgent structuring parsing type.

Range

  • SINGLE_LINE

  • MULTI_LINE

  • REGEX

  • MULTI_REGEX

  • SPLIT

  • JSON

  • NGINX

  • COMPOSE

  • ORC

demo_log

String

Definition

Sample log event.

Range

N/A

demo_fields

Array of DemoFieldAccess objects

Definition

Parsing fields of the sample log event.

processors

Array of Processor objects

Definition

ICAgent structuring parser.

log_split_size

Integer

Definition

Size at which to split a log file.

Range

N/A

application_id

String

Definition

ServiceStage application ID.

Range

N/A

environment_id

String

Definition

ServiceStage environment ID.

Range

N/A

component_id

Array of strings

Definition

ServiceStage component ID list.

recursive_depth

Integer

Definition

Maximum recursion depth of a collection path.

Range

N/A

access_config_type_source

String

Definition

Self-built software source of log ingestion.

Range

  • ECS

  • CCE

  • BMS

  • K8S

  • ServiceStageHost

  • ServiceStage

Table 17 AccessConfigDeatilCreate

Parameter

Type

Description

paths

Array of strings

Definition

Collection paths.

  • A path must start with a slash (/) or a letter followed by a colon and a backslash (for example, C:\).

  • A path cannot contain only slashes (/). The following special characters are not allowed: <>'|"

  • A path cannot start with /** or /*.

  • Only one double asterisk (**) can be contained in a path.

  • The container path and host path are mandatory for the CCE type and are not mandatory for the standard output.

black_paths

Array of strings

Definition

Collection blacklist paths.

  • A path must start with a slash (/) or a letter followed by a colon and a backslash (for example, C:\).

  • A path cannot contain only slashes (/). The following special characters are not allowed: <>'|"

  • A path cannot start with /** or /*.

  • Only one double asterisk (**) can be contained in a path.

format

AccessConfigFormatCreate object

Definition

Log format information.

windows_log_info

AccessConfigWindowsLogInfoCreate object

Definition

Windows event log information in a log ingestion configuration.

stdout

Boolean

Definition

Whether to enable container standard output collection in a CCE application log ingestion configuration.

Range

  • true: Container standard output collection is enabled.

  • false: Container standard output collection is disabled.

stderr

Boolean

Definition

Whether to enable container standard error collection in a CCE application log ingestion configuration.

Range

  • true: Container standard error collection is enabled.

  • false: Container standard error collection is disabled.

pathType

String

Definition

Data source type. This parameter is available only for CCE application log ingestion.

Range

  • HOST_FILE: node file type

  • CONTAINER_STDOUT: container standard output

  • CONTAINER_FILE: container file path

  • K8S_EVENT: Kubernetes event

namespaceRegex

String

Definition

Regular expression used to match Kubernetes namespaces by name. LTS will collect logs from containers within those matched namespaces. To collect logs of all namespaces, leave this parameter empty.

This parameter is available only for CCE application log ingestion.

Range

N/A

podNameRegex

String

Definition

Regular expression used to match Kubernetes pods by name. LTS will collect logs from containers within those matched pods. To collect logs of all pods, leave this parameter empty.

This parameter is available only for CCE application log ingestion.

Range

N/A

containerNameRegex

String

Definition

Regular expression used to match Kubernetes containers by name. Kubernetes container names are defined in spec.containers. LTS will collect logs from those matched containers. To collect logs of all containers, leave this parameter empty.

This parameter is available only for CCE application log ingestion.

Range

N/A

includeLabels

Map<String,String>

Definition

Container label whitelist. When configuring CCE application log ingestion, you can specify containers whose logs are to be collected by adding container label whitelists in the format of LabelKey:LabelValue. You can add up to 30 LabelKey:LabelValue pairs.

  • LabelKey: mandatory. It cannot start with a period (.) and can contain a maximum of 128 characters.

  • LabelValue: It can be left blank and can contain a maximum of 512 characters.

If LabelValue is empty, all containers with the specified LabelKey in their container labels are matched. If LabelValue is not empty, only containers with LabelKey=LabelValue in their container labels are matched. LabelKey must be exactly matched, while LabelValue supports regular expression matching.

excludeLabels

Map<String,String>

Definition

Container label blacklist. When configuring CCE application log ingestion, you can specify containers whose logs are not to be collected by adding container label blacklists in the format of LabelKey:LabelValue. You can add up to 30 LabelKey:LabelValue pairs.

  • LabelKey: mandatory. It cannot start with a period (.) and can contain a maximum of 128 characters.

  • LabelValue: It can be left blank and can contain a maximum of 512 characters.

If LabelValue is empty, all containers with the specified LabelKey in their container labels are excluded. If LabelValue is not empty, only containers with LabelKey=LabelValue in their container labels are excluded. LabelKey must be exactly matched, while LabelValue supports regular expression matching.

includeEnvs

Map<String,String>

Definition

Environment variable whitelist. When configuring CCE application log ingestion, you can specify containers whose logs are to be collected by adding environment variable whitelists in the format of LabelKey:LabelValue. You can add up to 30 LabelKey:LabelValue pairs.

  • LabelKey: mandatory. It cannot start with a period (.) and can contain a maximum of 128 characters.

  • LabelValue: It can be left blank and can contain a maximum of 512 characters.

If LabelValue is empty, all containers with the specified LabelKey in their environment variables are matched. If LabelValue is not empty, only containers with LabelKey=LabelValue in their environment variables are matched. LabelKey must be exactly matched, while LabelValue supports regular expression matching.

excludeEnvs

Map<String,String>

Definition

Environment variable blacklist. When configuring CCE application log ingestion, you can specify containers whose logs are not to be collected by adding environment variable blacklists in the format of LabelKey:LabelValue. You can add up to 30 LabelKey:LabelValue pairs.

  • LabelKey: mandatory. It cannot start with a period (.) and can contain a maximum of 128 characters.

  • LabelValue: It can be left blank and can contain a maximum of 512 characters.

If LabelValue is empty, all containers with the specified LabelKey in their environment variables are excluded. If LabelValue is not empty, only containers with LabelKey=LabelValue in their environment variables are excluded. LabelKey must be exactly matched, while LabelValue supports regular expression matching.

logLabels

Map<String,String>

Definition

Container label. When configuring CCE application log ingestion, you can use this parameter to add container label fields to logs. For example, if you set app as the LabelKey and app_alias as the LabelValue, when a container's labels contain app=lts, the field {app_alias:lts} will be added to the logs of that container.

logEnvs

Map<String,String>

Definition

Environment variable. When configuring CCE application log ingestion, you can use this parameter to add environment variable fields to logs. For example, if you set app as the environment variable key and app_alias as the value, when the Kubernetes environment variables contain app=lts, {app_alias:lts} will be added to the Kubernetes logs.

includeK8sLabels

Map<String,String>

Definition

Kubernetes label whitelist. When configuring CCE application log ingestion, you can specify containers whose logs are to be collected by adding Kubernetes label whitelists in the format of LabelKey:LabelValue. You can add up to 30 LabelKey:LabelValue pairs.

  • LabelKey: mandatory. It cannot start with a period (.) and can contain a maximum of 128 characters.

  • LabelValue: It can be left blank and can contain a maximum of 512 characters.

If LabelValue is empty, all containers with the specified LabelKey in their Kubernetes labels are matched. If LabelValue is not empty, only containers with LabelKey=LabelValue in their Kubernetes labels are matched. LabelKey must be exactly matched, while LabelValue supports regular expression matching.

excludeK8sLabels

Map<String,String>

Definition

Kubernetes label blacklist. When configuring CCE application log ingestion, you can specify containers whose logs are not to be collected by adding Kubernetes label blacklists in the format of LabelKey:LabelValue. You can add up to 30 LabelKey:LabelValue pairs.

  • LabelKey: mandatory. It cannot start with a period (.) and can contain a maximum of 128 characters.

  • LabelValue: It can be left blank and can contain a maximum of 512 characters.

If LabelValue is empty, all containers with the specified LabelKey in their Kubernetes labels are excluded. If LabelValue is not empty, only containers with LabelKey=LabelValue in their Kubernetes labels are excluded. LabelKey must be exactly matched, while LabelValue supports regular expression matching.

logK8s

Map<String,String>

Definition

Kubernetes label. When configuring CCE application log ingestion, you can use this parameter to add Kubernetes label fields to logs. For example, if you set app as the LabelKey and app_alias as the LabelValue, when a container's labels contain app=lts, the field {app_alias:lts} will be added to the logs of that container.

repeat_collect

Boolean

Definition

Whether repeated file collection is allowed.

Range

  • true: One host log file can be collected to multiple log streams.

  • false: Each collection path must be unique. That is, the same log file in the same host cannot be collected to different log streams.

system_fields

Array of strings

Definition

System built-in fields. When configuring a log ingestion rule, you can specify system fields to include in the tag data of each log reported. If this parameter is modified, the original configuration will be overwritten.

  • The system fields for host log files are hostName, hostId, hostIP, pathFile, hostIPv6, category, collectTime, and __host_group__.

  • The system fields for Kubernetes cluster container log files are hostName, hostId, hostIP, pathFile, hostIPv6, clusterId, podName, appName, containerName, nameSpace, category, collectTime, __host_group__, serviceID, podIp, clusterName, workloadType, and __image_name__.

custom_key_value

Map<String,String>

Definition

Custom key-value pairs. When configuring log ingestion, you can configure up to 20 custom key-value pairs to be included as fields in the tag data of each log reported. If this parameter is modified, the original configuration will be overwritten.

  • Key: Enter up to 128 characters, including letters, digits, underscores (_), and hyphens (-).

  • Value: Enter up to 1,024 characters.

includeLabelsLogical

String

Definition

Logic for multiple container label whitelists, which determines how the whitelists are applied. The value can be AND (all whitelists must be met) or OR (default value; any whitelist is met).

Range

  • AND

  • OR

excludeLabelsLogical

String

Definition

Logic for multiple container label blacklists, which determines how the blacklists are applied. The value can be AND (all blacklists must be met) or OR (default value; any blacklist is met).

Range

  • AND

  • OR

includeK8sLabelsLogical

String

Definition

Logic for multiple Kubernetes label whitelists, which determines how the whitelists are applied. The value can be AND (all whitelists must be met) or OR (default value; any whitelist is met).

Range

  • AND

  • OR

excludeK8sLabelsLogical

String

Definition

Logic for multiple Kubernetes label blacklists, which determines how the blacklists are applied. The value can be AND (all blacklists must be met) or OR (default value; any blacklist is met).

Range

  • AND

  • OR

includeEnvsLogical

String

Definition

Logic for multiple environment variable whitelists, which determines how the whitelists are applied. The value can be AND (all whitelists must be met) or OR (default value; any whitelist is met).

Range

  • AND

  • OR

excludeEnvsLogical

String

Definition

Logic for multiple environment variable blacklists, which determines how the blacklists are applied. The value can be AND (all blacklists must be met) or OR (default value; any blacklist is met).

Range

  • AND

  • OR

Table 18 AccessConfigFormatCreate

Parameter

Type

Description

single

AccessConfigFormatSingleCreate object

Definition

Single-line log. Each log line is displayed as a separate log event on the LTS console.

multi

AccessConfigFormatMutilCreate object

Definition

Multi-line log. Multiple consecutive log lines are displayed as one log event on the LTS console.

Table 19 AccessConfigFormatSingleCreate

Parameter

Type

Description

mode

String

Definition

Single-line log collection mode.

Range

  • system: system time

  • wildcard: time wildcard

value

String

Definition

Log time.

  • If mode is system, enter the current timestamp for value.

  • If mode is set to wildcard, enter a time wildcard for value. When a time wildcard 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.

Range

N/A

Table 20 AccessConfigFormatMutilCreate

Parameter

Type

Description

mode

String

Definition

Multi-line log collection mode.

Range

  • time: log time

  • regular: regular expression mode

value

String

Definition

Log time.

  • If mode is system, enter the current timestamp for value.

  • If mode is set to wildcard, enter a time wildcard for value. When a time wildcard 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.

Range

N/A

Table 21 AccessConfigWindowsLogInfoCreate

Parameter

Type

Description

categorys

Array of strings

Definition

Type of Windows event logs to be collected. There are four types:

  • Application

  • System

  • Security

  • Setup: start

time_offset

AccessConfigTimeOffset object

Definition

Offset of the first collection time. This parameter is used to correct the time deviation or calculate the relative time. If you set this parameter to 7, logs generated within the seven days before the collection start time are collected. This offset takes effect only for the first collection to ensure that the logs are not repeatedly collected.

event_level

Array of strings

Definition

Event level. You can filter Windows events based on their levels. This function is available only to Windows Vista or later. There are five levels:

  • information

  • warning

  • error

  • critical

  • verbose

Table 22 AccessConfigTimeOffset

Parameter

Type

Description

offset

Long

Definition

Time offset.

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

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

  • When unit is sec, the value of offset ranges from 1 to 604,800.

Range

N/A

unit

String

Definition

Unit of the offset time.

  • day

  • hour

  • sec

Range

N/A

Table 23 AccessConfigQueryLogInfo

Parameter

Type

Description

log_group_id

String

Definition

Log group ID.

Range

N/A

log_stream_id

String

Definition

Log stream ID.

Range

N/A

log_group_name

String

Definition

Log group name.

Range

N/A

log_stream_name

String

Definition

Log stream name.

Range

N/A

Table 24 AccessConfigHostGroupIdList

Parameter

Type

Description

host_group_id_list

Array of strings

Definition

Host group ID list.

Table 25 accessConfigTagResp

Parameter

Type

Description

key

String

Definition

Tag key.

Range

  • A tag key can contain letters, digits, spaces, and special characters (_.:=+-@), but cannot start or end with a space or start with sys.

  • A tag key can contain up to 128 characters.

value

String

Definition

Tag value.

Range

  • A tag value can contain letters, digits, spaces, and special characters (_.:=+-@).

  • A tag value can contain up to 255 characters.

Table 26 DemoFieldAccess

Parameter

Type

Description

field_name

String

Definition

Parsing fields of the sample log event.

Range

N/A

field_value

String

Definition

Value of a field in a sample log.

Range

N/A

Table 27 Processor

Parameter

Type

Description

type

String

Definition

Structuring parsing type. The values are as follows:

  • processor_regex: regular expression

  • processor_split_string: delimiter

  • processor_json: JSON

  • processor_gotime: custom time type

  • processor_filter_regex: log filtering

  • processor_drop: type of fields to be deleted

  • processor_rename: type of fields to be modified

Range

N/A

detail

Detail object

Definition

Structuring parsing configuration information.

Table 28 Detail

Parameter

Type

Description

source_key

String

Definition

Original field for storing log content before log structuring parsing. The default value is content.

Range

N/A

regex

String

Definition

Regular expression. Regular expression used to match logs.

Range

N/A

keys

Array of strings

Definition

Name of an extracted field. Set a corresponding field name for the extracted log content.

multi_line_regex

String

Definition

First line regular expression.

Range

N/A

keep_source

Boolean

Definition

Whether to upload raw logs.

Range

true: retains raw logs.

false: does not retain raw logs.

keep_source_if_parse_error

Boolean

Definition

Whether to upload logs that fail to be parsed.

Range

true: uploads logs that fail to be parsed.

false: does not upload logs that fail to be parsed.

split_sep

String

Definition

Delimiters. Set delimiters based on the log content, for example, vertical bar (|).

Range

N/A

split_type

String

Definition

Delimiter type. The value can be char (single character), special_char (invisible characters), or string.

Range

N/A

fields

Map<String,String>

Definition

Field name and value to be added, in the key-value pair format. You can add multiple key-value pairs.

drop_keys

Array of strings

Definition

List of discarded fields.

source_keys

Array of strings

Definition

Original field to be renamed.

dest_keys

Array of strings

Definition

Renamed field.

expand_depth

Integer

Definition

Depth of JSON expansion. The default value is 0, indicating that there is no limit. 1 indicates the one level, and so on.

Range

N/A

expand_connector

String

Definition

Connector for JSON expansion. The default value is a period (.).

Range

N/A

source_format

String

Definition

Format of the original time.

Range

N/A

source_value

String

Definition

Field value of the original time.

Range

N/A

set_time

Boolean

Definition

Whether to set the parsed time as the log time.

Range

N/A

include

Map<String,String>

Definition

Log filtering whitelist rule, in the format of key-value pairs. Each key indicates a log field and must be unique, with a maximum of 256 characters. The corresponding value is a regular expression that specifies the filtering criteria.

exclude

Map<String,String>

Definition

Log filtering blacklist rule, in the format of key-value pairs. Each key indicates a log field and must be unique, with a maximum of 256 characters. The corresponding value is a regular expression that specifies the filtering criteria.

Status code: 400

Table 29 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code. For details, see Error Codes.

Range

N/A

error_msg

String

Definition

Error message.

Range

N/A

Status code: 500

Table 30 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code. For details, see Error Codes.

Range

N/A

error_msg

String

Definition

Error message.

Range

N/A

Example Requests

  • Creating a log ingestion configuration (for CCE)

    POST https://{endpoint}/v3/{project_id}/lts/access-config
    
    {
      "access_config_name" : "myapinew322",
      "access_config_type" : "K8S_CCE",
      "access_config_detail" : {
        "pathType" : "CONTAINER_STDOUT",
        "stdout" : "true",
        "stderr" : "false",
        "format" : {
          "single" : {
            "mode" : "system",
            "value" : "1678969382000"
          }
        },
        "namespaceRegex" : "default",
        "podNameRegex" : "abc",
        "containerNameRegex" : "my",
        "includeLabels" : {
          "a" : "1"
        },
        "excludeLabels" : {
          "b" : "2"
        },
        "logLabels" : {
          "c" : "3"
        },
        "includeK8sLabels" : {
          "d" : "4"
        },
        "excludeK8sLabels" : {
          "e" : "5"
        },
        "logK8s" : {
          "f" : "6"
        },
        "includeEnvs" : {
          "g" : "7"
        },
        "excludeEnvs" : {
          "h" : "8"
        },
        "logEnvs" : {
          "i" : "9"
        }
      },
      "log_info" : {
        "log_group_id" : "9575cb24-290c-478e-a5db-88d6d1dc513b",
        "log_stream_id" : "3581bee9-8698-476e-a0ba-b0f310ed99cf"
      },
      "host_group_info" : {
        "host_group_id_list" : [ "12b0bbd1-4eda-456b-a641-647aa66bdeab" ]
      },
      "access_config_tag" : [ {
        "key" : "my01",
        "value" : "001"
      }, {
        "key" : "my02",
        "value" : "002"
      } ],
      "binary_collect" : "false",
      "log_split" : "false"
    }
  • Creating a log ingestion configuration (for ECS)

    POST https://{endpoint}/v3/{project_id}/lts/access-config
    
    {
      "access_config_name" : "Tesxxx",
      "access_config_type" : "AGENT",
      "access_config_detail" : {
        "paths" : [ "/test/xxx", "/texxx" ],
        "black_paths" : [ "/testxxx", "/tesxxx" ],
        "format" : {
          "multi" : {
            "mode" : "time",
            "value" : "YYYY-MM-DD hh:mm:ss"
          }
        },
        "windows_log_info" : {
          "categorys" : [ "System", "Security", "Setup" ],
          "event_level" : [ "warning", "error", "critical", "verbose" ],
          "time_offset" : {
            "offset" : 111,
            "unit" : "hour"
          }
        }
      },
      "log_info" : {
        "log_group_id" : "b179326d-c3be-4217-a3d9-xxxx",
        "log_stream_id" : "020a6fa0-4740-4888-af06-98xxxxxx"
      },
      "host_group_info" : {
        "host_group_id_list" : [ "4ee44d4f-a72b-40cf-a3c7-1xxxxx" ]
      },
      "access_config_tag" : [ {
        "key" : "xxx",
        "value" : "xxx"
      }, {
        "key" : "xxx1",
        "value" : "xxx1"
      } ]
    }

Example Responses

Status code: 200

The ingestion configuration is created.

{
  "access_config_detail" : {
    "containerNameRegex" : "container-1",
    "format" : {
      "single" : {
        "mode" : "system",
        "value" : "1678969382000"
      }
    },
    "namespaceRegex" : "default",
    "pathType" : "container_stdout",
    "paths" : [ ],
    "podNameRegex" : "mystdout-6d7458d77c-rhjcc",
    "stderr" : true,
    "stdout" : true
  },
  "access_config_id" : "03b16999-95cf-453b-9668-7aa1fafa564e",
  "access_config_name" : "myapinew32Y",
  "access_config_tag" : [ {
    "key" : "my01",
    "value" : "001"
  }, {
    "key" : "my02",
    "value" : "002"
  } ],
  "access_config_type" : "K8S_CCE",
  "binary_collect" : true,
  "create_time" : 1685626665176,
  "log_info" : {
    "log_group_id" : "9575cb24-290c-478e-a5db-88d6d1dc513b",
    "log_group_name" : "my-group",
    "log_stream_id" : "eea03c27-e041-4bec-bd03-6afa10a6561a",
    "log_stream_name" : "lts-topic-cceapi"
  },
  "log_split" : true
}

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

SDK Sample Code

The SDK sample code is as follows.

  • Creating a log ingestion configuration (for CCE)

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.lts.v2.region.LtsRegion;
    import com.huaweicloud.sdk.lts.v2.*;
    import com.huaweicloud.sdk.lts.v2.model.*;
    
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.util.HashMap;
    
    public class CreateAccessConfigSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
    
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
    
            LtsClient client = LtsClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(LtsRegion.valueOf("<YOUR REGION>"))
                    .build();
            CreateAccessConfigRequest request = new CreateAccessConfigRequest();
            CreateAccessConfigRequestBody body = new CreateAccessConfigRequestBody();
            List<AccessConfigTag> listbodyAccessConfigTag = new ArrayList<>();
            listbodyAccessConfigTag.add(
                new AccessConfigTag()
                    .withKey("my01")
                    .withValue("001")
            );
            listbodyAccessConfigTag.add(
                new AccessConfigTag()
                    .withKey("my02")
                    .withValue("002")
            );
            List<String> listHostGroupInfoHostGroupIdList = new ArrayList<>();
            listHostGroupInfoHostGroupIdList.add("12b0bbd1-4eda-456b-a641-647aa66bdeab");
            AccessConfigHostGroupIdListCreate hostGroupInfobody = new AccessConfigHostGroupIdListCreate();
            hostGroupInfobody.withHostGroupIdList(listHostGroupInfoHostGroupIdList);
            AccessConfigBaseLogInfoCreate logInfobody = new AccessConfigBaseLogInfoCreate();
            logInfobody.withLogGroupId("9575cb24-290c-478e-a5db-88d6d1dc513b")
                .withLogStreamId("3581bee9-8698-476e-a0ba-b0f310ed99cf");
            Map<String, String> listAccessConfigDetailLogK8s = new HashMap<>();
            listAccessConfigDetailLogK8s.put("f", "6");
            Map<String, String> listAccessConfigDetailExcludeK8sLabels = new HashMap<>();
            listAccessConfigDetailExcludeK8sLabels.put("e", "5");
            Map<String, String> listAccessConfigDetailIncludeK8sLabels = new HashMap<>();
            listAccessConfigDetailIncludeK8sLabels.put("d", "4");
            Map<String, String> listAccessConfigDetailLogEnvs = new HashMap<>();
            listAccessConfigDetailLogEnvs.put("i", "9");
            Map<String, String> listAccessConfigDetailLogLabels = new HashMap<>();
            listAccessConfigDetailLogLabels.put("c", "3");
            Map<String, String> listAccessConfigDetailExcludeEnvs = new HashMap<>();
            listAccessConfigDetailExcludeEnvs.put("h", "8");
            Map<String, String> listAccessConfigDetailIncludeEnvs = new HashMap<>();
            listAccessConfigDetailIncludeEnvs.put("g", "7");
            Map<String, String> listAccessConfigDetailExcludeLabels = new HashMap<>();
            listAccessConfigDetailExcludeLabels.put("b", "2");
            Map<String, String> listAccessConfigDetailIncludeLabels = new HashMap<>();
            listAccessConfigDetailIncludeLabels.put("a", "1");
            AccessConfigFormatSingleCreate singleFormat = new AccessConfigFormatSingleCreate();
            singleFormat.withMode(AccessConfigFormatSingleCreate.ModeEnum.fromValue("system"))
                .withValue("1678969382000");
            AccessConfigFormatCreate formatAccessConfigDetail = new AccessConfigFormatCreate();
            formatAccessConfigDetail.withSingle(singleFormat);
            AccessConfigDeatilCreate accessConfigDetailbody = new AccessConfigDeatilCreate();
            accessConfigDetailbody.withFormat(formatAccessConfigDetail)
                .withStdout(true)
                .withStderr(false)
                .withPathType(AccessConfigDeatilCreate.PathTypeEnum.fromValue("CONTAINER_STDOUT"))
                .withNamespaceRegex("default")
                .withPodNameRegex("abc")
                .withContainerNameRegex("my")
                .withIncludeLabels(listAccessConfigDetailIncludeLabels)
                .withExcludeLabels(listAccessConfigDetailExcludeLabels)
                .withIncludeEnvs(listAccessConfigDetailIncludeEnvs)
                .withExcludeEnvs(listAccessConfigDetailExcludeEnvs)
                .withLogLabels(listAccessConfigDetailLogLabels)
                .withLogEnvs(listAccessConfigDetailLogEnvs)
                .withIncludeK8sLabels(listAccessConfigDetailIncludeK8sLabels)
                .withExcludeK8sLabels(listAccessConfigDetailExcludeK8sLabels)
                .withLogK8s(listAccessConfigDetailLogK8s);
            body.withLogSplit(false);
            body.withBinaryCollect(false);
            body.withAccessConfigTag(listbodyAccessConfigTag);
            body.withHostGroupInfo(hostGroupInfobody);
            body.withLogInfo(logInfobody);
            body.withAccessConfigDetail(accessConfigDetailbody);
            body.withAccessConfigType(CreateAccessConfigRequestBody.AccessConfigTypeEnum.fromValue("K8S_CCE"));
            body.withAccessConfigName("myapinew322");
            request.withBody(body);
            try {
                CreateAccessConfigResponse response = client.createAccessConfig(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • Creating a log ingestion configuration (for ECS)

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.lts.v2.region.LtsRegion;
    import com.huaweicloud.sdk.lts.v2.*;
    import com.huaweicloud.sdk.lts.v2.model.*;
    
    import java.util.List;
    import java.util.ArrayList;
    
    public class CreateAccessConfigSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
    
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
    
            LtsClient client = LtsClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(LtsRegion.valueOf("<YOUR REGION>"))
                    .build();
            CreateAccessConfigRequest request = new CreateAccessConfigRequest();
            CreateAccessConfigRequestBody body = new CreateAccessConfigRequestBody();
            List<AccessConfigTag> listbodyAccessConfigTag = new ArrayList<>();
            listbodyAccessConfigTag.add(
                new AccessConfigTag()
                    .withKey("xxx")
                    .withValue("xxx")
            );
            listbodyAccessConfigTag.add(
                new AccessConfigTag()
                    .withKey("xxx1")
                    .withValue("xxx1")
            );
            List<String> listHostGroupInfoHostGroupIdList = new ArrayList<>();
            listHostGroupInfoHostGroupIdList.add("4ee44d4f-a72b-40cf-a3c7-1xxxxx");
            AccessConfigHostGroupIdListCreate hostGroupInfobody = new AccessConfigHostGroupIdListCreate();
            hostGroupInfobody.withHostGroupIdList(listHostGroupInfoHostGroupIdList);
            AccessConfigBaseLogInfoCreate logInfobody = new AccessConfigBaseLogInfoCreate();
            logInfobody.withLogGroupId("b179326d-c3be-4217-a3d9-xxxx")
                .withLogStreamId("020a6fa0-4740-4888-af06-98xxxxxx");
            List<AccessConfigWindowsLogInfoCreate.EventLevelEnum> listWindowsLogInfoEventLevel = new ArrayList<>();
            listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoCreate.EventLevelEnum.fromValue("warning"));
            listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoCreate.EventLevelEnum.fromValue("error"));
            listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoCreate.EventLevelEnum.fromValue("critical"));
            listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoCreate.EventLevelEnum.fromValue("verbose"));
            AccessConfigTimeOffset timeOffsetWindowsLogInfo = new AccessConfigTimeOffset();
            timeOffsetWindowsLogInfo.withOffset(111L)
                .withUnit(AccessConfigTimeOffset.UnitEnum.fromValue("hour"));
            List<AccessConfigWindowsLogInfoCreate.CategorysEnum> listWindowsLogInfoCategorys = new ArrayList<>();
            listWindowsLogInfoCategorys.add(AccessConfigWindowsLogInfoCreate.CategorysEnum.fromValue("System"));
            listWindowsLogInfoCategorys.add(AccessConfigWindowsLogInfoCreate.CategorysEnum.fromValue("Security"));
            listWindowsLogInfoCategorys.add(AccessConfigWindowsLogInfoCreate.CategorysEnum.fromValue("Setup"));
            AccessConfigWindowsLogInfoCreate windowsLogInfoAccessConfigDetail = new AccessConfigWindowsLogInfoCreate();
            windowsLogInfoAccessConfigDetail.withCategorys(listWindowsLogInfoCategorys)
                .withTimeOffset(timeOffsetWindowsLogInfo)
                .withEventLevel(listWindowsLogInfoEventLevel);
            AccessConfigFormatMutilCreate multiFormat = new AccessConfigFormatMutilCreate();
            multiFormat.withMode(AccessConfigFormatMutilCreate.ModeEnum.fromValue("time"))
                .withValue("YYYY-MM-DD hh:mm:ss");
            AccessConfigFormatCreate formatAccessConfigDetail = new AccessConfigFormatCreate();
            formatAccessConfigDetail.withMulti(multiFormat);
            List<String> listAccessConfigDetailBlackPaths = new ArrayList<>();
            listAccessConfigDetailBlackPaths.add("/testxxx");
            listAccessConfigDetailBlackPaths.add("/tesxxx");
            List<String> listAccessConfigDetailPaths = new ArrayList<>();
            listAccessConfigDetailPaths.add("/test/xxx");
            listAccessConfigDetailPaths.add("/texxx");
            AccessConfigDeatilCreate accessConfigDetailbody = new AccessConfigDeatilCreate();
            accessConfigDetailbody.withPaths(listAccessConfigDetailPaths)
                .withBlackPaths(listAccessConfigDetailBlackPaths)
                .withFormat(formatAccessConfigDetail)
                .withWindowsLogInfo(windowsLogInfoAccessConfigDetail);
            body.withAccessConfigTag(listbodyAccessConfigTag);
            body.withHostGroupInfo(hostGroupInfobody);
            body.withLogInfo(logInfobody);
            body.withAccessConfigDetail(accessConfigDetailbody);
            body.withAccessConfigType(CreateAccessConfigRequestBody.AccessConfigTypeEnum.fromValue("AGENT"));
            body.withAccessConfigName("Tesxxx");
            request.withBody(body);
            try {
                CreateAccessConfigResponse response = client.createAccessConfig(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • Creating a log ingestion configuration (for CCE)

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    # coding: utf-8
    
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdklts.v2.region.lts_region import LtsRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdklts.v2 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
    
        credentials = BasicCredentials(ak, sk, projectId)
    
        client = LtsClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(LtsRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = CreateAccessConfigRequest()
            listAccessConfigTagbody = [
                AccessConfigTag(
                    key="my01",
                    value="001"
                ),
                AccessConfigTag(
                    key="my02",
                    value="002"
                )
            ]
            listHostGroupIdListHostGroupInfo = [
                "12b0bbd1-4eda-456b-a641-647aa66bdeab"
            ]
            hostGroupInfobody = AccessConfigHostGroupIdListCreate(
                host_group_id_list=listHostGroupIdListHostGroupInfo
            )
            logInfobody = AccessConfigBaseLogInfoCreate(
                log_group_id="9575cb24-290c-478e-a5db-88d6d1dc513b",
                log_stream_id="3581bee9-8698-476e-a0ba-b0f310ed99cf"
            )
            listLogK8sAccessConfigDetail = {
                "f": "6"
            }
            listExcludeK8sLabelsAccessConfigDetail = {
                "e": "5"
            }
            listIncludeK8sLabelsAccessConfigDetail = {
                "d": "4"
            }
            listLogEnvsAccessConfigDetail = {
                "i": "9"
            }
            listLogLabelsAccessConfigDetail = {
                "c": "3"
            }
            listExcludeEnvsAccessConfigDetail = {
                "h": "8"
            }
            listIncludeEnvsAccessConfigDetail = {
                "g": "7"
            }
            listExcludeLabelsAccessConfigDetail = {
                "b": "2"
            }
            listIncludeLabelsAccessConfigDetail = {
                "a": "1"
            }
            singleFormat = AccessConfigFormatSingleCreate(
                mode="system",
                value="1678969382000"
            )
            formatAccessConfigDetail = AccessConfigFormatCreate(
                single=singleFormat
            )
            accessConfigDetailbody = AccessConfigDeatilCreate(
                format=formatAccessConfigDetail,
                stdout=True,
                stderr=False,
                path_type="CONTAINER_STDOUT",
                namespace_regex="default",
                pod_name_regex="abc",
                container_name_regex="my",
                include_labels=listIncludeLabelsAccessConfigDetail,
                exclude_labels=listExcludeLabelsAccessConfigDetail,
                include_envs=listIncludeEnvsAccessConfigDetail,
                exclude_envs=listExcludeEnvsAccessConfigDetail,
                log_labels=listLogLabelsAccessConfigDetail,
                log_envs=listLogEnvsAccessConfigDetail,
                include_k8s_labels=listIncludeK8sLabelsAccessConfigDetail,
                exclude_k8s_labels=listExcludeK8sLabelsAccessConfigDetail,
                log_k8s=listLogK8sAccessConfigDetail
            )
            request.body = CreateAccessConfigRequestBody(
                log_split=False,
                binary_collect=False,
                access_config_tag=listAccessConfigTagbody,
                host_group_info=hostGroupInfobody,
                log_info=logInfobody,
                access_config_detail=accessConfigDetailbody,
                access_config_type="K8S_CCE",
                access_config_name="myapinew322"
            )
            response = client.create_access_config(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • Creating a log ingestion configuration (for ECS)

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    # coding: utf-8
    
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdklts.v2.region.lts_region import LtsRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdklts.v2 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
    
        credentials = BasicCredentials(ak, sk, projectId)
    
        client = LtsClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(LtsRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = CreateAccessConfigRequest()
            listAccessConfigTagbody = [
                AccessConfigTag(
                    key="xxx",
                    value="xxx"
                ),
                AccessConfigTag(
                    key="xxx1",
                    value="xxx1"
                )
            ]
            listHostGroupIdListHostGroupInfo = [
                "4ee44d4f-a72b-40cf-a3c7-1xxxxx"
            ]
            hostGroupInfobody = AccessConfigHostGroupIdListCreate(
                host_group_id_list=listHostGroupIdListHostGroupInfo
            )
            logInfobody = AccessConfigBaseLogInfoCreate(
                log_group_id="b179326d-c3be-4217-a3d9-xxxx",
                log_stream_id="020a6fa0-4740-4888-af06-98xxxxxx"
            )
            listEventLevelWindowsLogInfo = [
                "warning",
                "error",
                "critical",
                "verbose"
            ]
            timeOffsetWindowsLogInfo = AccessConfigTimeOffset(
                offset=111,
                unit="hour"
            )
            listCategorysWindowsLogInfo = [
                "System",
                "Security",
                "Setup"
            ]
            windowsLogInfoAccessConfigDetail = AccessConfigWindowsLogInfoCreate(
                categorys=listCategorysWindowsLogInfo,
                time_offset=timeOffsetWindowsLogInfo,
                event_level=listEventLevelWindowsLogInfo
            )
            multiFormat = AccessConfigFormatMutilCreate(
                mode="time",
                value="YYYY-MM-DD hh:mm:ss"
            )
            formatAccessConfigDetail = AccessConfigFormatCreate(
                multi=multiFormat
            )
            listBlackPathsAccessConfigDetail = [
                "/testxxx",
                "/tesxxx"
            ]
            listPathsAccessConfigDetail = [
                "/test/xxx",
                "/texxx"
            ]
            accessConfigDetailbody = AccessConfigDeatilCreate(
                paths=listPathsAccessConfigDetail,
                black_paths=listBlackPathsAccessConfigDetail,
                format=formatAccessConfigDetail,
                windows_log_info=windowsLogInfoAccessConfigDetail
            )
            request.body = CreateAccessConfigRequestBody(
                access_config_tag=listAccessConfigTagbody,
                host_group_info=hostGroupInfobody,
                log_info=logInfobody,
                access_config_detail=accessConfigDetailbody,
                access_config_type="AGENT",
                access_config_name="Tesxxx"
            )
            response = client.create_access_config(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • Creating a log ingestion configuration (for CCE)

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        lts "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            Build()
    
        client := lts.NewLtsClient(
            lts.LtsClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.CreateAccessConfigRequest{}
    	keyAccessConfigTag:= "my01"
    	valueAccessConfigTag:= "001"
    	keyAccessConfigTag1:= "my02"
    	valueAccessConfigTag1:= "002"
    	var listAccessConfigTagbody = []model.AccessConfigTag{
            {
                Key: &keyAccessConfigTag,
                Value: &valueAccessConfigTag,
            },
            {
                Key: &keyAccessConfigTag1,
                Value: &valueAccessConfigTag1,
            },
        }
    	var listHostGroupIdListHostGroupInfo = []string{
            "12b0bbd1-4eda-456b-a641-647aa66bdeab",
        }
    	hostGroupInfobody := &model.AccessConfigHostGroupIdListCreate{
    		HostGroupIdList: listHostGroupIdListHostGroupInfo,
    	}
    	logInfobody := &model.AccessConfigBaseLogInfoCreate{
    		LogGroupId: "9575cb24-290c-478e-a5db-88d6d1dc513b",
    		LogStreamId: "3581bee9-8698-476e-a0ba-b0f310ed99cf",
    	}
    	var listLogK8sAccessConfigDetail = map[string]string{
            "f": "6",
        }
    	var listExcludeK8sLabelsAccessConfigDetail = map[string]string{
            "e": "5",
        }
    	var listIncludeK8sLabelsAccessConfigDetail = map[string]string{
            "d": "4",
        }
    	var listLogEnvsAccessConfigDetail = map[string]string{
            "i": "9",
        }
    	var listLogLabelsAccessConfigDetail = map[string]string{
            "c": "3",
        }
    	var listExcludeEnvsAccessConfigDetail = map[string]string{
            "h": "8",
        }
    	var listIncludeEnvsAccessConfigDetail = map[string]string{
            "g": "7",
        }
    	var listExcludeLabelsAccessConfigDetail = map[string]string{
            "b": "2",
        }
    	var listIncludeLabelsAccessConfigDetail = map[string]string{
            "a": "1",
        }
    	modeSingle:= model.GetAccessConfigFormatSingleCreateModeEnum().SYSTEM
    	valueSingle:= "1678969382000"
    	singleFormat := &model.AccessConfigFormatSingleCreate{
    		Mode: &modeSingle,
    		Value: &valueSingle,
    	}
    	formatAccessConfigDetail := &model.AccessConfigFormatCreate{
    		Single: singleFormat,
    	}
    	stdoutAccessConfigDetail:= true
    	stderrAccessConfigDetail:= false
    	pathTypeAccessConfigDetail:= model.GetAccessConfigDeatilCreatePathTypeEnum().CONTAINER_STDOUT
    	namespaceRegexAccessConfigDetail:= "default"
    	podNameRegexAccessConfigDetail:= "abc"
    	containerNameRegexAccessConfigDetail:= "my"
    	accessConfigDetailbody := &model.AccessConfigDeatilCreate{
    		Format: formatAccessConfigDetail,
    		Stdout: &stdoutAccessConfigDetail,
    		Stderr: &stderrAccessConfigDetail,
    		PathType: &pathTypeAccessConfigDetail,
    		NamespaceRegex: &namespaceRegexAccessConfigDetail,
    		PodNameRegex: &podNameRegexAccessConfigDetail,
    		ContainerNameRegex: &containerNameRegexAccessConfigDetail,
    		IncludeLabels: listIncludeLabelsAccessConfigDetail,
    		ExcludeLabels: listExcludeLabelsAccessConfigDetail,
    		IncludeEnvs: listIncludeEnvsAccessConfigDetail,
    		ExcludeEnvs: listExcludeEnvsAccessConfigDetail,
    		LogLabels: listLogLabelsAccessConfigDetail,
    		LogEnvs: listLogEnvsAccessConfigDetail,
    		IncludeK8sLabels: listIncludeK8sLabelsAccessConfigDetail,
    		ExcludeK8sLabels: listExcludeK8sLabelsAccessConfigDetail,
    		LogK8s: listLogK8sAccessConfigDetail,
    	}
    	logSplitCreateAccessConfigRequestBody:= false
    	binaryCollectCreateAccessConfigRequestBody:= false
    	request.Body = &model.CreateAccessConfigRequestBody{
    		LogSplit: &logSplitCreateAccessConfigRequestBody,
    		BinaryCollect: &binaryCollectCreateAccessConfigRequestBody,
    		AccessConfigTag: &listAccessConfigTagbody,
    		HostGroupInfo: hostGroupInfobody,
    		LogInfo: logInfobody,
    		AccessConfigDetail: accessConfigDetailbody,
    		AccessConfigType: model.GetCreateAccessConfigRequestBodyAccessConfigTypeEnum().K8_S_CCE,
    		AccessConfigName: "myapinew322",
    	}
    	response, err := client.CreateAccessConfig(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    
  • Creating a log ingestion configuration (for ECS)

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        lts "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            Build()
    
        client := lts.NewLtsClient(
            lts.LtsClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.CreateAccessConfigRequest{}
    	keyAccessConfigTag:= "xxx"
    	valueAccessConfigTag:= "xxx"
    	keyAccessConfigTag1:= "xxx1"
    	valueAccessConfigTag1:= "xxx1"
    	var listAccessConfigTagbody = []model.AccessConfigTag{
            {
                Key: &keyAccessConfigTag,
                Value: &valueAccessConfigTag,
            },
            {
                Key: &keyAccessConfigTag1,
                Value: &valueAccessConfigTag1,
            },
        }
    	var listHostGroupIdListHostGroupInfo = []string{
            "4ee44d4f-a72b-40cf-a3c7-1xxxxx",
        }
    	hostGroupInfobody := &model.AccessConfigHostGroupIdListCreate{
    		HostGroupIdList: listHostGroupIdListHostGroupInfo,
    	}
    	logInfobody := &model.AccessConfigBaseLogInfoCreate{
    		LogGroupId: "b179326d-c3be-4217-a3d9-xxxx",
    		LogStreamId: "020a6fa0-4740-4888-af06-98xxxxxx",
    	}
    	var listEventLevelWindowsLogInfo = []model.AccessConfigWindowsLogInfoCreateEventLevel{
            model.GetAccessConfigWindowsLogInfoCreateEventLevelEnum().WARNING,
    	    model.GetAccessConfigWindowsLogInfoCreateEventLevelEnum().ERROR,
    	    model.GetAccessConfigWindowsLogInfoCreateEventLevelEnum().CRITICAL,
    	    model.GetAccessConfigWindowsLogInfoCreateEventLevelEnum().VERBOSE,
        }
    	timeOffsetWindowsLogInfo := &model.AccessConfigTimeOffset{
    		Offset: int64(111),
    		Unit: model.GetAccessConfigTimeOffsetUnitEnum().HOUR,
    	}
    	var listCategorysWindowsLogInfo = []model.AccessConfigWindowsLogInfoCreateCategorys{
            model.GetAccessConfigWindowsLogInfoCreateCategorysEnum().SYSTEM,
    	    model.GetAccessConfigWindowsLogInfoCreateCategorysEnum().SECURITY,
    	    model.GetAccessConfigWindowsLogInfoCreateCategorysEnum().SETUP,
        }
    	windowsLogInfoAccessConfigDetail := &model.AccessConfigWindowsLogInfoCreate{
    		Categorys: listCategorysWindowsLogInfo,
    		TimeOffset: timeOffsetWindowsLogInfo,
    		EventLevel: listEventLevelWindowsLogInfo,
    	}
    	modeMulti:= model.GetAccessConfigFormatMutilCreateModeEnum().TIME
    	valueMulti:= "YYYY-MM-DD hh:mm:ss"
    	multiFormat := &model.AccessConfigFormatMutilCreate{
    		Mode: &modeMulti,
    		Value: &valueMulti,
    	}
    	formatAccessConfigDetail := &model.AccessConfigFormatCreate{
    		Multi: multiFormat,
    	}
    	var listBlackPathsAccessConfigDetail = []string{
            "/testxxx",
    	    "/tesxxx",
        }
    	var listPathsAccessConfigDetail = []string{
            "/test/xxx",
    	    "/texxx",
        }
    	accessConfigDetailbody := &model.AccessConfigDeatilCreate{
    		Paths: &listPathsAccessConfigDetail,
    		BlackPaths: &listBlackPathsAccessConfigDetail,
    		Format: formatAccessConfigDetail,
    		WindowsLogInfo: windowsLogInfoAccessConfigDetail,
    	}
    	request.Body = &model.CreateAccessConfigRequestBody{
    		AccessConfigTag: &listAccessConfigTagbody,
    		HostGroupInfo: hostGroupInfobody,
    		LogInfo: logInfobody,
    		AccessConfigDetail: accessConfigDetailbody,
    		AccessConfigType: model.GetCreateAccessConfigRequestBodyAccessConfigTypeEnum().AGENT,
    		AccessConfigName: "Tesxxx",
    	}
    	response, err := client.CreateAccessConfig(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

  • Creating a log ingestion configuration (for CCE)

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.lts.v2.region.LtsRegion;
    import com.huaweicloud.sdk.lts.v2.*;
    import com.huaweicloud.sdk.lts.v2.model.*;
    
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.util.HashMap;
    
    public class CreateAccessConfigSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
    
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
    
            LtsClient client = LtsClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(LtsRegion.valueOf("<YOUR REGION>"))
                    .build();
            CreateAccessConfigRequest request = new CreateAccessConfigRequest();
            CreateAccessConfigRequestBody body = new CreateAccessConfigRequestBody();
            List<AccessConfigTag> listbodyAccessConfigTag = new ArrayList<>();
            listbodyAccessConfigTag.add(
                new AccessConfigTag()
                    .withKey("my01")
                    .withValue("001")
            );
            listbodyAccessConfigTag.add(
                new AccessConfigTag()
                    .withKey("my02")
                    .withValue("002")
            );
            List<String> listHostGroupInfoHostGroupIdList = new ArrayList<>();
            listHostGroupInfoHostGroupIdList.add("12b0bbd1-4eda-456b-a641-647aa66bdeab");
            AccessConfigHostGroupIdListCreate hostGroupInfobody = new AccessConfigHostGroupIdListCreate();
            hostGroupInfobody.withHostGroupIdList(listHostGroupInfoHostGroupIdList);
            AccessConfigBaseLogInfoCreate logInfobody = new AccessConfigBaseLogInfoCreate();
            logInfobody.withLogGroupId("9575cb24-290c-478e-a5db-88d6d1dc513b")
                .withLogStreamId("3581bee9-8698-476e-a0ba-b0f310ed99cf");
            Map<String, String> listAccessConfigDetailLogK8s = new HashMap<>();
            listAccessConfigDetailLogK8s.put("f", "6");
            Map<String, String> listAccessConfigDetailExcludeK8sLabels = new HashMap<>();
            listAccessConfigDetailExcludeK8sLabels.put("e", "5");
            Map<String, String> listAccessConfigDetailIncludeK8sLabels = new HashMap<>();
            listAccessConfigDetailIncludeK8sLabels.put("d", "4");
            Map<String, String> listAccessConfigDetailLogEnvs = new HashMap<>();
            listAccessConfigDetailLogEnvs.put("i", "9");
            Map<String, String> listAccessConfigDetailLogLabels = new HashMap<>();
            listAccessConfigDetailLogLabels.put("c", "3");
            Map<String, String> listAccessConfigDetailExcludeEnvs = new HashMap<>();
            listAccessConfigDetailExcludeEnvs.put("h", "8");
            Map<String, String> listAccessConfigDetailIncludeEnvs = new HashMap<>();
            listAccessConfigDetailIncludeEnvs.put("g", "7");
            Map<String, String> listAccessConfigDetailExcludeLabels = new HashMap<>();
            listAccessConfigDetailExcludeLabels.put("b", "2");
            Map<String, String> listAccessConfigDetailIncludeLabels = new HashMap<>();
            listAccessConfigDetailIncludeLabels.put("a", "1");
            AccessConfigFormatSingleCreate singleFormat = new AccessConfigFormatSingleCreate();
            singleFormat.withMode(AccessConfigFormatSingleCreate.ModeEnum.fromValue("system"))
                .withValue("1678969382000");
            AccessConfigFormatCreate formatAccessConfigDetail = new AccessConfigFormatCreate();
            formatAccessConfigDetail.withSingle(singleFormat);
            AccessConfigDeatilCreate accessConfigDetailbody = new AccessConfigDeatilCreate();
            accessConfigDetailbody.withFormat(formatAccessConfigDetail)
                .withStdout(true)
                .withStderr(false)
                .withPathType(AccessConfigDeatilCreate.PathTypeEnum.fromValue("CONTAINER_STDOUT"))
                .withNamespaceRegex("default")
                .withPodNameRegex("abc")
                .withContainerNameRegex("my")
                .withIncludeLabels(listAccessConfigDetailIncludeLabels)
                .withExcludeLabels(listAccessConfigDetailExcludeLabels)
                .withIncludeEnvs(listAccessConfigDetailIncludeEnvs)
                .withExcludeEnvs(listAccessConfigDetailExcludeEnvs)
                .withLogLabels(listAccessConfigDetailLogLabels)
                .withLogEnvs(listAccessConfigDetailLogEnvs)
                .withIncludeK8sLabels(listAccessConfigDetailIncludeK8sLabels)
                .withExcludeK8sLabels(listAccessConfigDetailExcludeK8sLabels)
                .withLogK8s(listAccessConfigDetailLogK8s);
            body.withLogSplit(false);
            body.withBinaryCollect(false);
            body.withAccessConfigTag(listbodyAccessConfigTag);
            body.withHostGroupInfo(hostGroupInfobody);
            body.withLogInfo(logInfobody);
            body.withAccessConfigDetail(accessConfigDetailbody);
            body.withAccessConfigType(CreateAccessConfigRequestBody.AccessConfigTypeEnum.fromValue("K8S_CCE"));
            body.withAccessConfigName("myapinew322");
            request.withBody(body);
            try {
                CreateAccessConfigResponse response = client.createAccessConfig(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • Creating a log ingestion configuration (for ECS)

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.lts.v2.region.LtsRegion;
    import com.huaweicloud.sdk.lts.v2.*;
    import com.huaweicloud.sdk.lts.v2.model.*;
    
    import java.util.List;
    import java.util.ArrayList;
    
    public class CreateAccessConfigSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
    
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
    
            LtsClient client = LtsClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(LtsRegion.valueOf("<YOUR REGION>"))
                    .build();
            CreateAccessConfigRequest request = new CreateAccessConfigRequest();
            CreateAccessConfigRequestBody body = new CreateAccessConfigRequestBody();
            List<AccessConfigTag> listbodyAccessConfigTag = new ArrayList<>();
            listbodyAccessConfigTag.add(
                new AccessConfigTag()
                    .withKey("xxx")
                    .withValue("xxx")
            );
            listbodyAccessConfigTag.add(
                new AccessConfigTag()
                    .withKey("xxx1")
                    .withValue("xxx1")
            );
            List<String> listHostGroupInfoHostGroupIdList = new ArrayList<>();
            listHostGroupInfoHostGroupIdList.add("4ee44d4f-a72b-40cf-a3c7-1xxxxx");
            AccessConfigHostGroupIdListCreate hostGroupInfobody = new AccessConfigHostGroupIdListCreate();
            hostGroupInfobody.withHostGroupIdList(listHostGroupInfoHostGroupIdList);
            AccessConfigBaseLogInfoCreate logInfobody = new AccessConfigBaseLogInfoCreate();
            logInfobody.withLogGroupId("b179326d-c3be-4217-a3d9-xxxx")
                .withLogStreamId("020a6fa0-4740-4888-af06-98xxxxxx");
            List<AccessConfigWindowsLogInfoCreate.EventLevelEnum> listWindowsLogInfoEventLevel = new ArrayList<>();
            listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoCreate.EventLevelEnum.fromValue("warning"));
            listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoCreate.EventLevelEnum.fromValue("error"));
            listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoCreate.EventLevelEnum.fromValue("critical"));
            listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoCreate.EventLevelEnum.fromValue("verbose"));
            AccessConfigTimeOffset timeOffsetWindowsLogInfo = new AccessConfigTimeOffset();
            timeOffsetWindowsLogInfo.withOffset(111L)
                .withUnit(AccessConfigTimeOffset.UnitEnum.fromValue("hour"));
            List<AccessConfigWindowsLogInfoCreate.CategorysEnum> listWindowsLogInfoCategorys = new ArrayList<>();
            listWindowsLogInfoCategorys.add(AccessConfigWindowsLogInfoCreate.CategorysEnum.fromValue("System"));
            listWindowsLogInfoCategorys.add(AccessConfigWindowsLogInfoCreate.CategorysEnum.fromValue("Security"));
            listWindowsLogInfoCategorys.add(AccessConfigWindowsLogInfoCreate.CategorysEnum.fromValue("Setup"));
            AccessConfigWindowsLogInfoCreate windowsLogInfoAccessConfigDetail = new AccessConfigWindowsLogInfoCreate();
            windowsLogInfoAccessConfigDetail.withCategorys(listWindowsLogInfoCategorys)
                .withTimeOffset(timeOffsetWindowsLogInfo)
                .withEventLevel(listWindowsLogInfoEventLevel);
            AccessConfigFormatMutilCreate multiFormat = new AccessConfigFormatMutilCreate();
            multiFormat.withMode(AccessConfigFormatMutilCreate.ModeEnum.fromValue("time"))
                .withValue("YYYY-MM-DD hh:mm:ss");
            AccessConfigFormatCreate formatAccessConfigDetail = new AccessConfigFormatCreate();
            formatAccessConfigDetail.withMulti(multiFormat);
            List<String> listAccessConfigDetailBlackPaths = new ArrayList<>();
            listAccessConfigDetailBlackPaths.add("/testxxx");
            listAccessConfigDetailBlackPaths.add("/tesxxx");
            List<String> listAccessConfigDetailPaths = new ArrayList<>();
            listAccessConfigDetailPaths.add("/test/xxx");
            listAccessConfigDetailPaths.add("/texxx");
            AccessConfigDeatilCreate accessConfigDetailbody = new AccessConfigDeatilCreate();
            accessConfigDetailbody.withPaths(listAccessConfigDetailPaths)
                .withBlackPaths(listAccessConfigDetailBlackPaths)
                .withFormat(formatAccessConfigDetail)
                .withWindowsLogInfo(windowsLogInfoAccessConfigDetail);
            body.withAccessConfigTag(listbodyAccessConfigTag);
            body.withHostGroupInfo(hostGroupInfobody);
            body.withLogInfo(logInfobody);
            body.withAccessConfigDetail(accessConfigDetailbody);
            body.withAccessConfigType(CreateAccessConfigRequestBody.AccessConfigTypeEnum.fromValue("AGENT"));
            body.withAccessConfigName("Tesxxx");
            request.withBody(body);
            try {
                CreateAccessConfigResponse response = client.createAccessConfig(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • Creating a log ingestion configuration (for CCE)

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    # coding: utf-8
    
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdklts.v2.region.lts_region import LtsRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdklts.v2 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
    
        credentials = BasicCredentials(ak, sk, projectId)
    
        client = LtsClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(LtsRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = CreateAccessConfigRequest()
            listAccessConfigTagbody = [
                AccessConfigTag(
                    key="my01",
                    value="001"
                ),
                AccessConfigTag(
                    key="my02",
                    value="002"
                )
            ]
            listHostGroupIdListHostGroupInfo = [
                "12b0bbd1-4eda-456b-a641-647aa66bdeab"
            ]
            hostGroupInfobody = AccessConfigHostGroupIdListCreate(
                host_group_id_list=listHostGroupIdListHostGroupInfo
            )
            logInfobody = AccessConfigBaseLogInfoCreate(
                log_group_id="9575cb24-290c-478e-a5db-88d6d1dc513b",
                log_stream_id="3581bee9-8698-476e-a0ba-b0f310ed99cf"
            )
            listLogK8sAccessConfigDetail = {
                "f": "6"
            }
            listExcludeK8sLabelsAccessConfigDetail = {
                "e": "5"
            }
            listIncludeK8sLabelsAccessConfigDetail = {
                "d": "4"
            }
            listLogEnvsAccessConfigDetail = {
                "i": "9"
            }
            listLogLabelsAccessConfigDetail = {
                "c": "3"
            }
            listExcludeEnvsAccessConfigDetail = {
                "h": "8"
            }
            listIncludeEnvsAccessConfigDetail = {
                "g": "7"
            }
            listExcludeLabelsAccessConfigDetail = {
                "b": "2"
            }
            listIncludeLabelsAccessConfigDetail = {
                "a": "1"
            }
            singleFormat = AccessConfigFormatSingleCreate(
                mode="system",
                value="1678969382000"
            )
            formatAccessConfigDetail = AccessConfigFormatCreate(
                single=singleFormat
            )
            accessConfigDetailbody = AccessConfigDeatilCreate(
                format=formatAccessConfigDetail,
                stdout=True,
                stderr=False,
                path_type="CONTAINER_STDOUT",
                namespace_regex="default",
                pod_name_regex="abc",
                container_name_regex="my",
                include_labels=listIncludeLabelsAccessConfigDetail,
                exclude_labels=listExcludeLabelsAccessConfigDetail,
                include_envs=listIncludeEnvsAccessConfigDetail,
                exclude_envs=listExcludeEnvsAccessConfigDetail,
                log_labels=listLogLabelsAccessConfigDetail,
                log_envs=listLogEnvsAccessConfigDetail,
                include_k8s_labels=listIncludeK8sLabelsAccessConfigDetail,
                exclude_k8s_labels=listExcludeK8sLabelsAccessConfigDetail,
                log_k8s=listLogK8sAccessConfigDetail
            )
            request.body = CreateAccessConfigRequestBody(
                log_split=False,
                binary_collect=False,
                access_config_tag=listAccessConfigTagbody,
                host_group_info=hostGroupInfobody,
                log_info=logInfobody,
                access_config_detail=accessConfigDetailbody,
                access_config_type="K8S_CCE",
                access_config_name="myapinew322"
            )
            response = client.create_access_config(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • Creating a log ingestion configuration (for ECS)

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    # coding: utf-8
    
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdklts.v2.region.lts_region import LtsRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdklts.v2 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
    
        credentials = BasicCredentials(ak, sk, projectId)
    
        client = LtsClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(LtsRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = CreateAccessConfigRequest()
            listAccessConfigTagbody = [
                AccessConfigTag(
                    key="xxx",
                    value="xxx"
                ),
                AccessConfigTag(
                    key="xxx1",
                    value="xxx1"
                )
            ]
            listHostGroupIdListHostGroupInfo = [
                "4ee44d4f-a72b-40cf-a3c7-1xxxxx"
            ]
            hostGroupInfobody = AccessConfigHostGroupIdListCreate(
                host_group_id_list=listHostGroupIdListHostGroupInfo
            )
            logInfobody = AccessConfigBaseLogInfoCreate(
                log_group_id="b179326d-c3be-4217-a3d9-xxxx",
                log_stream_id="020a6fa0-4740-4888-af06-98xxxxxx"
            )
            listEventLevelWindowsLogInfo = [
                "warning",
                "error",
                "critical",
                "verbose"
            ]
            timeOffsetWindowsLogInfo = AccessConfigTimeOffset(
                offset=111,
                unit="hour"
            )
            listCategorysWindowsLogInfo = [
                "System",
                "Security",
                "Setup"
            ]
            windowsLogInfoAccessConfigDetail = AccessConfigWindowsLogInfoCreate(
                categorys=listCategorysWindowsLogInfo,
                time_offset=timeOffsetWindowsLogInfo,
                event_level=listEventLevelWindowsLogInfo
            )
            multiFormat = AccessConfigFormatMutilCreate(
                mode="time",
                value="YYYY-MM-DD hh:mm:ss"
            )
            formatAccessConfigDetail = AccessConfigFormatCreate(
                multi=multiFormat
            )
            listBlackPathsAccessConfigDetail = [
                "/testxxx",
                "/tesxxx"
            ]
            listPathsAccessConfigDetail = [
                "/test/xxx",
                "/texxx"
            ]
            accessConfigDetailbody = AccessConfigDeatilCreate(
                paths=listPathsAccessConfigDetail,
                black_paths=listBlackPathsAccessConfigDetail,
                format=formatAccessConfigDetail,
                windows_log_info=windowsLogInfoAccessConfigDetail
            )
            request.body = CreateAccessConfigRequestBody(
                access_config_tag=listAccessConfigTagbody,
                host_group_info=hostGroupInfobody,
                log_info=logInfobody,
                access_config_detail=accessConfigDetailbody,
                access_config_type="AGENT",
                access_config_name="Tesxxx"
            )
            response = client.create_access_config(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • Creating a log ingestion configuration (for CCE)

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        lts "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            Build()
    
        client := lts.NewLtsClient(
            lts.LtsClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.CreateAccessConfigRequest{}
    	keyAccessConfigTag:= "my01"
    	valueAccessConfigTag:= "001"
    	keyAccessConfigTag1:= "my02"
    	valueAccessConfigTag1:= "002"
    	var listAccessConfigTagbody = []model.AccessConfigTag{
            {
                Key: &keyAccessConfigTag,
                Value: &valueAccessConfigTag,
            },
            {
                Key: &keyAccessConfigTag1,
                Value: &valueAccessConfigTag1,
            },
        }
    	var listHostGroupIdListHostGroupInfo = []string{
            "12b0bbd1-4eda-456b-a641-647aa66bdeab",
        }
    	hostGroupInfobody := &model.AccessConfigHostGroupIdListCreate{
    		HostGroupIdList: listHostGroupIdListHostGroupInfo,
    	}
    	logInfobody := &model.AccessConfigBaseLogInfoCreate{
    		LogGroupId: "9575cb24-290c-478e-a5db-88d6d1dc513b",
    		LogStreamId: "3581bee9-8698-476e-a0ba-b0f310ed99cf",
    	}
    	var listLogK8sAccessConfigDetail = map[string]string{
            "f": "6",
        }
    	var listExcludeK8sLabelsAccessConfigDetail = map[string]string{
            "e": "5",
        }
    	var listIncludeK8sLabelsAccessConfigDetail = map[string]string{
            "d": "4",
        }
    	var listLogEnvsAccessConfigDetail = map[string]string{
            "i": "9",
        }
    	var listLogLabelsAccessConfigDetail = map[string]string{
            "c": "3",
        }
    	var listExcludeEnvsAccessConfigDetail = map[string]string{
            "h": "8",
        }
    	var listIncludeEnvsAccessConfigDetail = map[string]string{
            "g": "7",
        }
    	var listExcludeLabelsAccessConfigDetail = map[string]string{
            "b": "2",
        }
    	var listIncludeLabelsAccessConfigDetail = map[string]string{
            "a": "1",
        }
    	modeSingle:= model.GetAccessConfigFormatSingleCreateModeEnum().SYSTEM
    	valueSingle:= "1678969382000"
    	singleFormat := &model.AccessConfigFormatSingleCreate{
    		Mode: &modeSingle,
    		Value: &valueSingle,
    	}
    	formatAccessConfigDetail := &model.AccessConfigFormatCreate{
    		Single: singleFormat,
    	}
    	stdoutAccessConfigDetail:= true
    	stderrAccessConfigDetail:= false
    	pathTypeAccessConfigDetail:= model.GetAccessConfigDeatilCreatePathTypeEnum().CONTAINER_STDOUT
    	namespaceRegexAccessConfigDetail:= "default"
    	podNameRegexAccessConfigDetail:= "abc"
    	containerNameRegexAccessConfigDetail:= "my"
    	accessConfigDetailbody := &model.AccessConfigDeatilCreate{
    		Format: formatAccessConfigDetail,
    		Stdout: &stdoutAccessConfigDetail,
    		Stderr: &stderrAccessConfigDetail,
    		PathType: &pathTypeAccessConfigDetail,
    		NamespaceRegex: &namespaceRegexAccessConfigDetail,
    		PodNameRegex: &podNameRegexAccessConfigDetail,
    		ContainerNameRegex: &containerNameRegexAccessConfigDetail,
    		IncludeLabels: listIncludeLabelsAccessConfigDetail,
    		ExcludeLabels: listExcludeLabelsAccessConfigDetail,
    		IncludeEnvs: listIncludeEnvsAccessConfigDetail,
    		ExcludeEnvs: listExcludeEnvsAccessConfigDetail,
    		LogLabels: listLogLabelsAccessConfigDetail,
    		LogEnvs: listLogEnvsAccessConfigDetail,
    		IncludeK8sLabels: listIncludeK8sLabelsAccessConfigDetail,
    		ExcludeK8sLabels: listExcludeK8sLabelsAccessConfigDetail,
    		LogK8s: listLogK8sAccessConfigDetail,
    	}
    	logSplitCreateAccessConfigRequestBody:= false
    	binaryCollectCreateAccessConfigRequestBody:= false
    	request.Body = &model.CreateAccessConfigRequestBody{
    		LogSplit: &logSplitCreateAccessConfigRequestBody,
    		BinaryCollect: &binaryCollectCreateAccessConfigRequestBody,
    		AccessConfigTag: &listAccessConfigTagbody,
    		HostGroupInfo: hostGroupInfobody,
    		LogInfo: logInfobody,
    		AccessConfigDetail: accessConfigDetailbody,
    		AccessConfigType: model.GetCreateAccessConfigRequestBodyAccessConfigTypeEnum().K8_S_CCE,
    		AccessConfigName: "myapinew322",
    	}
    	response, err := client.CreateAccessConfig(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    
  • Creating a log ingestion configuration (for ECS)

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        lts "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            Build()
    
        client := lts.NewLtsClient(
            lts.LtsClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.CreateAccessConfigRequest{}
    	keyAccessConfigTag:= "xxx"
    	valueAccessConfigTag:= "xxx"
    	keyAccessConfigTag1:= "xxx1"
    	valueAccessConfigTag1:= "xxx1"
    	var listAccessConfigTagbody = []model.AccessConfigTag{
            {
                Key: &keyAccessConfigTag,
                Value: &valueAccessConfigTag,
            },
            {
                Key: &keyAccessConfigTag1,
                Value: &valueAccessConfigTag1,
            },
        }
    	var listHostGroupIdListHostGroupInfo = []string{
            "4ee44d4f-a72b-40cf-a3c7-1xxxxx",
        }
    	hostGroupInfobody := &model.AccessConfigHostGroupIdListCreate{
    		HostGroupIdList: listHostGroupIdListHostGroupInfo,
    	}
    	logInfobody := &model.AccessConfigBaseLogInfoCreate{
    		LogGroupId: "b179326d-c3be-4217-a3d9-xxxx",
    		LogStreamId: "020a6fa0-4740-4888-af06-98xxxxxx",
    	}
    	var listEventLevelWindowsLogInfo = []model.AccessConfigWindowsLogInfoCreateEventLevel{
            model.GetAccessConfigWindowsLogInfoCreateEventLevelEnum().WARNING,
    	    model.GetAccessConfigWindowsLogInfoCreateEventLevelEnum().ERROR,
    	    model.GetAccessConfigWindowsLogInfoCreateEventLevelEnum().CRITICAL,
    	    model.GetAccessConfigWindowsLogInfoCreateEventLevelEnum().VERBOSE,
        }
    	timeOffsetWindowsLogInfo := &model.AccessConfigTimeOffset{
    		Offset: int64(111),
    		Unit: model.GetAccessConfigTimeOffsetUnitEnum().HOUR,
    	}
    	var listCategorysWindowsLogInfo = []model.AccessConfigWindowsLogInfoCreateCategorys{
            model.GetAccessConfigWindowsLogInfoCreateCategorysEnum().SYSTEM,
    	    model.GetAccessConfigWindowsLogInfoCreateCategorysEnum().SECURITY,
    	    model.GetAccessConfigWindowsLogInfoCreateCategorysEnum().SETUP,
        }
    	windowsLogInfoAccessConfigDetail := &model.AccessConfigWindowsLogInfoCreate{
    		Categorys: listCategorysWindowsLogInfo,
    		TimeOffset: timeOffsetWindowsLogInfo,
    		EventLevel: listEventLevelWindowsLogInfo,
    	}
    	modeMulti:= model.GetAccessConfigFormatMutilCreateModeEnum().TIME
    	valueMulti:= "YYYY-MM-DD hh:mm:ss"
    	multiFormat := &model.AccessConfigFormatMutilCreate{
    		Mode: &modeMulti,
    		Value: &valueMulti,
    	}
    	formatAccessConfigDetail := &model.AccessConfigFormatCreate{
    		Multi: multiFormat,
    	}
    	var listBlackPathsAccessConfigDetail = []string{
            "/testxxx",
    	    "/tesxxx",
        }
    	var listPathsAccessConfigDetail = []string{
            "/test/xxx",
    	    "/texxx",
        }
    	accessConfigDetailbody := &model.AccessConfigDeatilCreate{
    		Paths: &listPathsAccessConfigDetail,
    		BlackPaths: &listBlackPathsAccessConfigDetail,
    		Format: formatAccessConfigDetail,
    		WindowsLogInfo: windowsLogInfoAccessConfigDetail,
    	}
    	request.Body = &model.CreateAccessConfigRequestBody{
    		AccessConfigTag: &listAccessConfigTagbody,
    		HostGroupInfo: hostGroupInfobody,
    		LogInfo: logInfobody,
    		AccessConfigDetail: accessConfigDetailbody,
    		AccessConfigType: model.GetCreateAccessConfigRequestBodyAccessConfigTypeEnum().AGENT,
    		AccessConfigName: "Tesxxx",
    	}
    	response, err := client.CreateAccessConfig(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

The ingestion configuration is created.

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.

Utilizamos cookies para mejorar nuestro sitio y tu experiencia. Al continuar navegando en nuestro sitio, tú aceptas nuestra política de cookies. Descubre más

Feedback
咨询盘古Doer

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback