Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
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
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
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
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
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
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Cloud Transformation
Well-Architected Framework
Cloud Adoption 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
KooMessage
KooPhone
KooDrive
Help Center/ Log Tank Service/ API Reference/ APIs/ Log Ingestion/ Modifying a Log Ingestion Configuration

Modifying a Log Ingestion Configuration

Function

This API is used to modify a log ingestion configuration.

Calling Method

For details, see Calling APIs.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

Minimum: 32

Maximum: 32

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

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

Minimum: 1000

Maximum: 2000

Content-Type

Yes

String

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

Minimum: 30

Maximum: 30

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

access_config_id

Yes

String

Ingestion configuration ID.

Minimum: 36

Maximum: 36

access_config_name

No

String

Ingestion configuration name.

It should match the regular expression: ^(?!.)(?!)(?!.*?.$)[\u4e00-\u9fa5a-zA-Z0-9-.]{1,64}$.

access_config_detail

No

AccessConfigDeatilUpdate object

Ingestion configuration details.

host_group_info

No

AccessConfigHostGroupIdList object

Host group ID list.

access_config_tag

No

Array of accessConfigTag objects

Tag information. A tag key must be unique. Up to 20 tags are supported.

log_split

No

Boolean

Log splitting.

binary_collect

No

Boolean

Binary collection.

cluster_id

No

String

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

incremental_collect

No

Boolean

Whether to perform incremental collection. true indicates incremental collection and false indicates full collection.

encoding_format

No

String

Encoding format. The default format is UTF-8.

processor_type

No

String

IC structuring parsing type.

demo_log

No

String

Example log.

demo_fields

No

Array of DemoFieldAccess objects

Example log parsing field.

processors

No

Array of Processor objects

IC structuring parser.

application_id

No

String

ServiceStage application ID.

environment_id

No

String

ServiceStage environment ID.

component_id

No

Array of strings

ServiceStage component ID.

Table 4 AccessConfigDeatilUpdate

Parameter

Mandatory

Type

Description

paths

No

Array of strings

  1. The path must start with a slash (/) or a letter:.

  2. The value cannot contain special characters <>'| "and cannot contain only slashes (/).

  3. The level-1 directory does not support wildcard characters () and cannot start with /** /.

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

  5. The maximum number is 10.

Minimum: 1

Maximum: 128

black_paths

No

Array of strings

  1. The path must start with a slash (/) or a letter:.

  2. The value cannot contain special characters <>'| "and cannot contain only slashes (/).

  3. The level-1 directory does not support wildcard characters () and cannot start with /** /.

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

  5. The maximum number is 10.

Minimum: 1

Maximum: 128

format

No

AccessConfigFormatUpdate object

Log format. Set it to either single or multi.

windows_log_info

No

AccessConfigWindowsLogInfoUpdate object

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

stdout

No

Boolean

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

stderr

No

Boolean

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

pathType

No

String

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

Enumeration values:

  • HOST_FILE

  • CONTAINER_STDOUT

  • CONTAINER_FILE

namespaceRegex

No

String

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

podNameRegex

No

String

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

containerNameRegex

No

String

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

includeLabels

No

Map<String,String>

Container label whitelist. A maximum of 30 container labels can be created. The key names must be unique. This parameter is used only for CCE log ingestion.

excludeLabels

No

Map<String,String>

Container label blacklist. A maximum of 30 container labels can be created. The key names must be unique. This parameter is used only for CCE log ingestion.

includeEnvs

No

Map<String,String>

Environment variable whitelist. A maximum of 30 environment variable whitelists can be created. Key names must be unique. This parameter is used only for CCE log ingestion.

excludeEnvs

No

Map<String,String>

Environment variable blacklist. A maximum of 30 environment variables can be created. The key names must be unique. This parameter is used only for CCE log ingestion.

logLabels

No

Map<String,String>

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

logEnvs

No

Map<String,String>

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

includeK8sLabels

No

Map<String,String>

Kubernetes label whitelist. A maximum of 30 Kubernetes label whitelists can be created. The key names must be unique. This parameter is used only for CCE log ingestion.

excludeK8sLabels

No

Map<String,String>

Kubernetes label blacklist. A maximum of 30 Kubernetes label blacklists can be created. The key names must be unique. This parameter is used only for CCE log ingestion.

logK8s

No

Map<String,String>

Kubernetes label. A maximum of 30 Kubernetes labels can be created. The key names must be unique. This parameter is used only for CCE log ingestion.

system_fields

No

Array of strings

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.

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__.

If this parameter is transferred during modification, the original configuration will be overwritten.

When you configure metadata for the first time, this parameter is mandatory. In this case, ["pathFile"] must be entered and other fields are optional.

custom_key_value

No

Map<String,String>

Custom key-value pairs. When configuring a log ingestion rule, you can configure up to 20 custom key-value pairs to include in the tag data of each log reported.

A key can contain up to 128 characters, including letters, digits, hyphens (-), and underscores (_).

A value can contain up to 1,024 characters.

If this parameter is transferred during modification, the original configuration will be overwritten.

includeLabelsLogical

No

String

Logic for the container label whitelist to take effect. The value can be AND or OR (default). When there are multiple conditions for the container label whitelist, AND indicates that the whitelist takes effect only when all the conditions are met, and OR indicates that the whitelist takes effect when one of the conditions is met.

excludeLabelsLogical

No

String

Logic for the container label blacklist to take effect. The value can be AND or OR (default). When there are multiple conditions for the container label blacklist, AND indicates that the blacklist takes effect only when all the conditions are met, and OR indicates that the blacklist takes effect when one of the conditions is met.

includeK8sLabelsLogical

No

String

Logic for the Kubernetes label whitelist to take effect. The value can be AND or OR (default). When there are multiple conditions for the Kubernetes label whitelist, AND indicates that the whitelist takes effect only when all the conditions are met, and OR indicates that the whitelist takes effect when one of the conditions is met.

excludeK8sLabelsLogical

No

String

Logic for the Kubernetes label blacklist to take effect. The value can be AND or OR (default). When there are multiple conditions for the Kubernetes label blacklist, AND indicates that the blacklist takes effect only when all the conditions are met, and OR indicates that the blacklist takes effect when one of the conditions is met.

includeEnvsLogical

No

String

Logic for the environment variable whitelist to take effect. The value can be AND or OR (default). When there are multiple conditions for the environment variable whitelist, AND indicates that the whitelist takes effect only when all the conditions are met, and OR indicates that the whitelist takes effect when one of the conditions is met.

excludeEnvsLogical

No

String

Logic for the environment variable blacklist to take effect. The value can be AND or OR (default). When there are multiple conditions for the environment variable blacklist, AND indicates that the blacklist takes effect only when all the conditions are met, and OR indicates that the blacklist takes effect when one of the conditions is met.

Table 5 AccessConfigFormatUpdate

Parameter

Mandatory

Type

Description

single

No

AccessConfigFormatSingle object

Single-line logs.

multi

No

AccessConfigFormatMutil object

Multi-line logs.

Table 6 AccessConfigFormatSingle

Parameter

Mandatory

Type

Description

mode

Yes

String

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

Enumeration values:

  • system

  • wildcard

value

Yes

String

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

Minimum: 1

Maximum: 64

Table 7 AccessConfigFormatMutil

Parameter

Mandatory

Type

Description

mode

Yes

String

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

Enumeration values:

  • time

  • regular

value

Yes

String

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

Minimum: 1

Maximum: 64

Table 8 AccessConfigWindowsLogInfoUpdate

Parameter

Mandatory

Type

Description

categorys

No

Array of strings

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

Enumeration values:

  • Application

  • System

  • Security

  • Setup

time_offset

No

AccessConfigTimeOffset object

Time offset.

event_level

No

Array of strings

Event level. information, warning, error, critical, verbose.

Enumeration values:

  • information

  • warning

  • error

  • critical

  • verbose

Table 9 AccessConfigTimeOffset

Parameter

Mandatory

Type

Description

offset

Yes

Long

Parameter description:

Time offset.

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

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

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

Value range:

N/A.

unit

Yes

String

Parameter description:

Unit of the time offset. The value can be day, hour, or sec.

Value range:

N/A.

Table 10 AccessConfigHostGroupIdList

Parameter

Mandatory

Type

Description

host_group_id_list

Yes

Array of strings

Parameter description:

Host group ID list.

Value range:

N/A.

Table 11 accessConfigTag

Parameter

Mandatory

Type

Description

key

No

String

Parameter description:

Tag key, which must be unique.

Constraints:

N/A.

Value range:

It can contain up to 128 characters, including only letters, digits, spaces, and special characters (_.:=+-@). Do not start or end with a space, nor start with sys.

value

No

String

Parameter description:

Tag value.

Value range:

It can contain up to 255 characters, including only letters, digits, spaces, and special characters (_.:=+-@).

Table 12 DemoFieldAccess

Parameter

Mandatory

Type

Description

field_name

No

String

Parameter description:

Field name, which must be the same as that in keys.

Value range:

N/A.

field_value

No

String

Parameter description:

Field value.

Value range:

N/A.

Table 13 Processor

Parameter

Mandatory

Type

Description

type

No

String

Parameter description:

Parser type.

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

Value range:

N/A.

detail

No

Detail object

Parameter description:

Parser configuration.

Value range:

N/A.

Table 14 Detail

Parameter

Mandatory

Type

Description

source_key

No

String

Parameter description:

Custom time key field name.

Value range:

N/A.

regex

No

String

Parameter description:

Regular expression for parsing. This field is required for a single-line completely regular expression or a multi-line completely regular expression.

Value range:

N/A.

keys

No

Array of strings

Parameter description:

Field name list, which is consistent with the field_name field.

Value range:

N/A.

multi_line_regex

No

String

Parameter description:

First line regular expression.

Value range:

N/A.

keep_source

No

Boolean

Parameter description:

Whether to upload raw logs.

Value range:

N/A.

keep_source_if_parse_error

No

Boolean

Parameter description:

Whether to upload logs that fail to be parsed.

Value range:

N/A.

split_sep

No

String

Parameter description:

Delimiters.

Value range:

The maximum length of custom characters is 10 characters, and the maximum length of a custom string is 30 characters.

split_type

No

String

Parameter description:

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

Value range:

N/A.

fields

No

Map<String,String>

Parameter description:

List of added fields, in [/topic/body/section/table/tgroup/tbody/row/entry/p/br {""}) (br] format.

Value range:

N/A.

drop_keys

No

Array of strings

Parameter description:

List of deleted fields.

Value range:

N/A.

source_keys

No

Array of strings

Parameter description:

List of source field names for renaming fields.

Value range:

N/A.

dest_keys

No

Array of strings

Parameter description:

List of field names that are renamed and replaced.

Value range:

N/A.

expand_depth

No

Integer

Parameter description:

JSON parsing depth. The value ranges from 1 (default) to 4.

Value range:

N/A.

expand_connector

No

String

Parameter description:

JSON parsing field name connector.

Value range:

N/A.

source_format

No

String

Parameter description:

Custom time format.

Value range:

N/A.

source_value

No

String

Parameter description:

Custom time field value.

Value range:

N/A.

set_time

No

Boolean

Parameter description:

Whether to enable the custom time function.

Value range:

N/A.

include

No

Map<String,String>

Parameter description:

A key of a log filtering whitelist rule can contain up to 256 characters, and a value can contain up to 128 characters. A key must be unique.

Value range:

N/A.

exclude

No

Map<String,String>

Parameter description:

A key of a log filtering whitelist rule can contain up to 256 characters, and a value can contain up to 128 characters. A key must be unique.

Value range:

N/A.

Response Parameters

Status code: 200

Table 15 Response body parameters

Parameter

Type

Description

access_config_id

String

Parameter description:

Ingestion configuration ID.

Value range:

N/A.

access_config_name

String

Parameter description:

Ingestion configuration name.

Value range:

N/A.

access_config_type

String

Parameter description:

Ingestion configuration type.

The value can be AGENT (ECS log ingestion) or K8S_CCE (CCE log ingestion).

Value range:

N/A.

create_time

Long

Parameter description:

Creation time.

Value range:

N/A.

access_config_detail

AccessConfigDeatilCreate object

Parameter description:

Ingestion configuration details.

Value range:

N/A.

log_info

AccessConfigQueryLogInfo object

Parameter description:

Log details.

Value range:

N/A.

host_group_info

AccessConfigHostGroupIdList object

Parameter description:

Host group ID list.

Value range:

N/A.

access_config_tag

Array of accessConfigTag objects

Parameter description:

Tag information. A tag key must be unique. Up to 20 tags are allowed.

Value range:

N/A.

log_split

Boolean

Parameter description:

Log splitting.

Value range:

N/A.

binary_collect

Boolean

Parameter description:

Binary file collection.

Value range:

N/A.

cluster_id

String

Parameter description:

CCE cluster ID.

Value range:

N/A.

encoding_format

String

Parameter description:

Encoding format. The default format is UTF-8.

Value range:

N/A.

incremental_collect

Boolean

Parameter description:

Collection policy. The value can be incremental.

Value range:

N/A.

processor_type

String

Parameter description:

ICAgent structuring parsing type.

Value range:

N/A.

demo_log

String

Parameter description:

Sample log event.

Value range:

N/A.

demo_fields

Array of DemoFieldAccess objects

Parameter description:

Parsing fields of the sample log event.

Value range:

N/A.

processors

Array of Processor objects

Parameter description:

ICAgent structuring parser.

Value range:

N/A.

application_id

String

Parameter description:

ServiceStage application ID.

Value range:

N/A.

environment_id

String

Parameter description:

ServiceStage environment ID.

Value range:

N/A.

component_id

Array of strings

Parameter description:

ServiceStage component ID.

Value range:

N/A.

Table 16 AccessConfigDeatilCreate

Parameter

Type

Description

paths

Array of strings

Parameter description:

Collection paths.

  1. A path must start with a slash (/) or Letter:\.

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

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

  4. 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.

Value range:

N/A.

black_paths

Array of strings

Parameter description:

Collection path blacklist.

  1. A path must start with a slash (/) or Letter:\.

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

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

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

Value range:

N/A.

format

AccessConfigFormatCreate object

Parameter description:

Collection path blacklist.

  1. A path must start with a slash (/) or Letter:\.

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

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

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

Value range:

N/A.

windows_log_info

AccessConfigWindowsLogInfoCreate object

Parameter description:

Windows event logs.

Value range:

N/A.

stdout

Boolean

Parameter description:

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

Value range:

N/A.

stderr

Boolean

Parameter description:

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

Value range:

N/A.

pathType

String

Parameter description:

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

Value range:

N/A.

namespaceRegex

String

Parameter description:

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

Value range:

N/A.

podNameRegex

String

Parameter description:

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

Value range:

N/A.

containerNameRegex

String

Parameter description:

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

Value range:

N/A.

includeLabels

Map<String,String>

Parameter description:

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

Value range:

N/A.

excludeLabels

Map<String,String>

Parameter description:

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

Value range:

N/A.

includeEnvs

Map<String,String>

Parameter description:

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

Value range:

N/A.

excludeEnvs

Map<String,String>

Parameter description:

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

Value range:

N/A.

logLabels

Map<String,String>

Parameter description:

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

Value range:

N/A.

logEnvs

Map<String,String>

Parameter description:

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

Value range:

N/A.

includeK8sLabels

Map<String,String>

Parameter description:

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

Value range:

N/A.

excludeK8sLabels

Map<String,String>

Parameter description:

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

Value range:

N/A.

logK8s

Map<String,String>

Parameter description:

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

Value range:

N/A.

repeat_collect

Boolean

Parameter description:

Forcible repeated collection.

Value range:

N/A.

system_fields

Array of strings

Parameter description:

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.

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__.

If this parameter is transferred during modification, the original configuration will be overwritten.

When you configure metadata for the first time, this parameter is mandatory and the value is ["pathFile"]. In this case, pathFile is mandatory and other fields are optional.

Value range:

N/A.

custom_key_value

Map<String,String>

Parameter description:

Custom key-value pairs. When configuring a log ingestion rule, you can configure up to 20 custom key-value pairs to include in the tag data of each log reported. A key can contain up to 128 characters, including letters, digits, hyphens (-), and underscores (_). A value can contain up to 1,024 characters.

If this parameter is transferred during modification, the original configuration will be overwritten.

Value range:

N/A.

includeLabelsLogical

String

Parameter description:

Logic for the container label whitelist to take effect. The value can be AND or OR (default). When there are multiple conditions for the container label whitelist, AND indicates that the whitelist takes effect only when all the conditions are met, and OR indicates that the whitelist takes effect when one of the conditions is met.

Value range:

N/A.

excludeLabelsLogical

String

Parameter description:

Logic for the container label blacklist to take effect. The value can be AND or OR (default). When there are multiple conditions for the container label blacklist, AND indicates that the blacklist takes effect only when all the conditions are met, and OR indicates that the blacklist takes effect when one of the conditions is met.

Value range:

N/A.

includeK8sLabelsLogical

String

Parameter description:

Logic for the Kubernetes label whitelist to take effect. The value can be AND or OR (default). When there are multiple conditions for the Kubernetes label whitelist, AND indicates that the whitelist takes effect only when all the conditions are met, and OR indicates that the whitelist takes effect when one of the conditions is met.

Value range:

N/A.

excludeK8sLabelsLogical

String

Parameter description:

Logic for the Kubernetes label blacklist to take effect. The value can be AND or OR (default). When there are multiple conditions for the Kubernetes label blacklist, AND indicates that the blacklist takes effect only when all the conditions are met, and OR indicates that the blacklist takes effect when one of the conditions is met.

Value range:

N/A.

includeEnvsLogical

String

Parameter description:

Logic for the environment variable whitelist to take effect. The value can be AND or OR (default). When there are multiple conditions for the environment variable whitelist, AND indicates that the whitelist takes effect only when all the conditions are met, and OR indicates that the whitelist takes effect when one of the conditions is met.

Value range:

N/A.

excludeEnvsLogical

String

Parameter description:

Logic for the environment variable blacklist to take effect. The value can be AND or OR (default). When there are multiple conditions for the environment variable blacklist, AND indicates that the blacklist takes effect only when all the conditions are met, and OR indicates that the blacklist takes effect when one of the conditions is met.

Value range:

N/A.

Table 17 AccessConfigFormatCreate

Parameter

Type

Description

single

AccessConfigFormatSingleCreate object

Parameter description:

Single-line format is set as the log ingestion format.

Value range:

N/A.

multi

AccessConfigFormatMutilCreate object

Parameter description:

Multi-line format is set as the log ingestion format.

Value range:

N/A.

Table 18 AccessConfigFormatSingleCreate

Parameter

Type

Description

mode

String

Parameter description:

Single-line logs. The value can be system (system time) or wildcard (time wildcard).

Value range:

N/A.

value

String

Parameter description:

Log time.

If mode is system, the value is the current timestamp.

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

Value range:

N/A.

Table 19 AccessConfigFormatMutilCreate

Parameter

Type

Description

mode

String

Parameter description:

Single-line logs.

The value can be time (log time) or regular (regular expression).

Value range:

N/A.

value

String

Parameter description:

Log time.

If mode is regular, the value is a regular expression.

If mode is time, the value is a time wildcard, which is used 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.

Value range:

N/A.

Table 20 AccessConfigWindowsLogInfoCreate

Parameter

Type

Description

categorys

Array of strings

Parameter description:

Type of Windows event logs to be collected.

The value can be Application (application system logs), System (system logs), Security (security logs), or Setup (startup logs).

Value range:

N/A.

time_offset

AccessConfigTimeOffset object

Parameter description:

Time offset for log ingestion.

Value range:

N/A.

event_level

Array of strings

Parameter description:

Event level. The value can be information, warning, error, critical, or verbose.

Value range:

N/A.

Table 21 AccessConfigTimeOffset

Parameter

Type

Description

offset

Long

Parameter description:

Time offset.

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

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

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

Value range:

N/A.

unit

String

Parameter description:

Unit of the time offset. The value can be day, hour, or sec.

Value range:

N/A.

Table 22 AccessConfigQueryLogInfo

Parameter

Type

Description

log_group_id

String

Parameter description:

Log group ID.

Value range:

N/A.

log_stream_id

String

Parameter description:

Log stream ID.

Value range:

N/A.

log_group_name

String

Parameter description:

Log group name.

Value range:

N/A.

log_stream_name

String

Parameter description:

Log stream name.

Value range:

N/A.

Table 23 AccessConfigHostGroupIdList

Parameter

Type

Description

host_group_id_list

Array of strings

Parameter description:

Host group ID list.

Value range:

N/A.

Table 24 accessConfigTag

Parameter

Type

Description

key

String

Parameter description:

Tag key, which must be unique.

Constraints:

N/A.

Value range:

It can contain up to 128 characters, including only letters, digits, spaces, and special characters (_.:=+-@). Do not start or end with a space, nor start with sys.

value

String

Parameter description:

Tag value.

Value range:

It can contain up to 255 characters, including only letters, digits, spaces, and special characters (_.:=+-@).

Table 25 DemoFieldAccess

Parameter

Type

Description

field_name

String

Parameter description:

Field name, which must be the same as that in keys.

Value range:

N/A.

field_value

String

Parameter description:

Field value.

Value range:

N/A.

Table 26 Processor

Parameter

Type

Description

type

String

Parameter description:

Parser type.

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

Value range:

N/A.

detail

Detail object

Parameter description:

Parser configuration.

Value range:

N/A.

Table 27 Detail

Parameter

Type

Description

source_key

String

Parameter description:

Custom time key field name.

Value range:

N/A.

regex

String

Parameter description:

Regular expression for parsing. This field is required for a single-line completely regular expression or a multi-line completely regular expression.

Value range:

N/A.

keys

Array of strings

Parameter description:

Field name list, which is consistent with the field_name field.

Value range:

N/A.

multi_line_regex

String

Parameter description:

First line regular expression.

Value range:

N/A.

keep_source

Boolean

Parameter description:

Whether to upload raw logs.

Value range:

N/A.

keep_source_if_parse_error

Boolean

Parameter description:

Whether to upload logs that fail to be parsed.

Value range:

N/A.

split_sep

String

Parameter description:

Delimiters.

Value range:

The maximum length of custom characters is 10 characters, and the maximum length of a custom string is 30 characters.

split_type

String

Parameter description:

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

Value range:

N/A.

fields

Map<String,String>

Parameter description:

List of added fields, in [/topic/body/section/table/tgroup/tbody/row/entry/p/br {""}) (br] format.

Value range:

N/A.

drop_keys

Array of strings

Parameter description:

List of deleted fields.

Value range:

N/A.

source_keys

Array of strings

Parameter description:

List of source field names for renaming fields.

Value range:

N/A.

dest_keys

Array of strings

Parameter description:

List of field names that are renamed and replaced.

Value range:

N/A.

expand_depth

Integer

Parameter description:

JSON parsing depth. The value ranges from 1 (default) to 4.

Value range:

N/A.

expand_connector

String

Parameter description:

JSON parsing field name connector.

Value range:

N/A.

source_format

String

Parameter description:

Custom time format.

Value range:

N/A.

source_value

String

Parameter description:

Custom time field value.

Value range:

N/A.

set_time

Boolean

Parameter description:

Whether to enable the custom time function.

Value range:

N/A.

include

Map<String,String>

Parameter description:

A key of a log filtering whitelist rule can contain up to 256 characters, and a value can contain up to 128 characters. A key must be unique.

Value range:

N/A.

exclude

Map<String,String>

Parameter description:

A key of a log filtering whitelist rule can contain up to 256 characters, and a value can contain up to 128 characters. A key must be unique.

Value range:

N/A.

Status code: 400

Table 28 Response body parameters

Parameter

Type

Description

error_code

String

Parameter description:

Error code.

Value range:

Minimum characters: 8

Maximum characters: 8

error_msg

String

Parameter description:

Error message.

Value range:

N/A.

Status code: 500

Table 29 Response body parameters

Parameter

Type

Description

error_code

String

Parameter description:

Error code.

Value range:

Minimum characters: 8

Maximum characters: 8

error_msg

String

Parameter description:

Error message.

Value range:

N/A.

Example Requests

Modifying a Log Ingestion Configuration (for ECS)

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

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

Example Responses

Status code: 200

Ingestion configuration modified.

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

Status code: 400

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

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

Status code: 500

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

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

SDK Sample Code

The SDK sample code is as follows.

Modifying 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
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 UpdateAccessConfigSolution {

    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();
        UpdateAccessConfigRequest request = new UpdateAccessConfigRequest();
        UpdateAccessConfigRequestBody body = new UpdateAccessConfigRequestBody();
        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("de4dbed4-a3bc-4877-a7ee-096a2a63e036");
        AccessConfigHostGroupIdList hostGroupInfobody = new AccessConfigHostGroupIdList();
        hostGroupInfobody.withHostGroupIdList(listHostGroupInfoHostGroupIdList);
        List<AccessConfigWindowsLogInfoUpdate.EventLevelEnum> listWindowsLogInfoEventLevel = new ArrayList<>();
        listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoUpdate.EventLevelEnum.fromValue("information"));
        listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoUpdate.EventLevelEnum.fromValue("warning"));
        listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoUpdate.EventLevelEnum.fromValue("error"));
        listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoUpdate.EventLevelEnum.fromValue("critical"));
        listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoUpdate.EventLevelEnum.fromValue("verbose"));
        AccessConfigTimeOffsetCreate timeOffsetWindowsLogInfo = new AccessConfigTimeOffsetCreate();
        timeOffsetWindowsLogInfo.withOffset(7L)
            .withUnit(AccessConfigTimeOffsetCreate.UnitEnum.fromValue("day"));
        List<AccessConfigWindowsLogInfoUpdate.CategorysEnum> listWindowsLogInfoCategorys = new ArrayList<>();
        listWindowsLogInfoCategorys.add(AccessConfigWindowsLogInfoUpdate.CategorysEnum.fromValue("Application"));
        listWindowsLogInfoCategorys.add(AccessConfigWindowsLogInfoUpdate.CategorysEnum.fromValue("System"));
        AccessConfigWindowsLogInfoUpdate windowsLogInfoAccessConfigDetail = new AccessConfigWindowsLogInfoUpdate();
        windowsLogInfoAccessConfigDetail.withCategorys(listWindowsLogInfoCategorys)
            .withTimeOffset(timeOffsetWindowsLogInfo)
            .withEventLevel(listWindowsLogInfoEventLevel);
        AccessConfigFormatMutil multiFormat = new AccessConfigFormatMutil();
        multiFormat.withMode(AccessConfigFormatMutil.ModeEnum.fromValue("regular"))
            .withValue("aaaa");
        AccessConfigFormatUpdate formatAccessConfigDetail = new AccessConfigFormatUpdate();
        formatAccessConfigDetail.withMulti(multiFormat);
        List<String> listAccessConfigDetailPaths = new ArrayList<>();
        listAccessConfigDetailPaths.add("/test/222");
        listAccessConfigDetailPaths.add("/test/111");
        AccessConfigDeatilUpdate accessConfigDetailbody = new AccessConfigDeatilUpdate();
        accessConfigDetailbody.withPaths(listAccessConfigDetailPaths)
            .withFormat(formatAccessConfigDetail)
            .withWindowsLogInfo(windowsLogInfoAccessConfigDetail);
        body.withAccessConfigTag(listbodyAccessConfigTag);
        body.withHostGroupInfo(hostGroupInfobody);
        body.withAccessConfigDetail(accessConfigDetailbody);
        body.withAccessConfigId("ed90802a-8475-4702-955e-e3ee16a5dde9");
        request.withBody(body);
        try {
            UpdateAccessConfigResponse response = client.updateAccessConfig(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());
        }
    }
}

Modifying 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
# 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 = UpdateAccessConfigRequest()
        listAccessConfigTagbody = [
            AccessConfigTag(
                key="xxx",
                value="xxx"
            ),
            AccessConfigTag(
                key="xxx1",
                value="xxx1"
            )
        ]
        listHostGroupIdListHostGroupInfo = [
            "de4dbed4-a3bc-4877-a7ee-096a2a63e036"
        ]
        hostGroupInfobody = AccessConfigHostGroupIdList(
            host_group_id_list=listHostGroupIdListHostGroupInfo
        )
        listEventLevelWindowsLogInfo = [
            "information",
            "warning",
            "error",
            "critical",
            "verbose"
        ]
        timeOffsetWindowsLogInfo = AccessConfigTimeOffsetCreate(
            offset=7,
            unit="day"
        )
        listCategorysWindowsLogInfo = [
            "Application",
            "System"
        ]
        windowsLogInfoAccessConfigDetail = AccessConfigWindowsLogInfoUpdate(
            categorys=listCategorysWindowsLogInfo,
            time_offset=timeOffsetWindowsLogInfo,
            event_level=listEventLevelWindowsLogInfo
        )
        multiFormat = AccessConfigFormatMutil(
            mode="regular",
            value="aaaa"
        )
        formatAccessConfigDetail = AccessConfigFormatUpdate(
            multi=multiFormat
        )
        listPathsAccessConfigDetail = [
            "/test/222",
            "/test/111"
        ]
        accessConfigDetailbody = AccessConfigDeatilUpdate(
            paths=listPathsAccessConfigDetail,
            format=formatAccessConfigDetail,
            windows_log_info=windowsLogInfoAccessConfigDetail
        )
        request.body = UpdateAccessConfigRequestBody(
            access_config_tag=listAccessConfigTagbody,
            host_group_info=hostGroupInfobody,
            access_config_detail=accessConfigDetailbody,
            access_config_id="ed90802a-8475-4702-955e-e3ee16a5dde9"
        )
        response = client.update_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)

Modifying 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
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.UpdateAccessConfigRequest{}
	keyAccessConfigTag:= "xxx"
	valueAccessConfigTag:= "xxx"
	keyAccessConfigTag1:= "xxx1"
	valueAccessConfigTag1:= "xxx1"
	var listAccessConfigTagbody = []model.AccessConfigTag{
        {
            Key: &keyAccessConfigTag,
            Value: &valueAccessConfigTag,
        },
        {
            Key: &keyAccessConfigTag1,
            Value: &valueAccessConfigTag1,
        },
    }
	var listHostGroupIdListHostGroupInfo = []string{
        "de4dbed4-a3bc-4877-a7ee-096a2a63e036",
    }
	hostGroupInfobody := &model.AccessConfigHostGroupIdList{
		HostGroupIdList: listHostGroupIdListHostGroupInfo,
	}
	var listEventLevelWindowsLogInfo = []model.AccessConfigWindowsLogInfoUpdateEventLevel{
        model.GetAccessConfigWindowsLogInfoUpdateEventLevelEnum().INFORMATION,
	    model.GetAccessConfigWindowsLogInfoUpdateEventLevelEnum().WARNING,
	    model.GetAccessConfigWindowsLogInfoUpdateEventLevelEnum().ERROR,
	    model.GetAccessConfigWindowsLogInfoUpdateEventLevelEnum().CRITICAL,
	    model.GetAccessConfigWindowsLogInfoUpdateEventLevelEnum().VERBOSE,
    }
	timeOffsetWindowsLogInfo := &model.AccessConfigTimeOffsetCreate{
		Offset: int64(7),
		Unit: model.GetAccessConfigTimeOffsetCreateUnitEnum().DAY,
	}
	var listCategorysWindowsLogInfo = []model.AccessConfigWindowsLogInfoUpdateCategorys{
        model.GetAccessConfigWindowsLogInfoUpdateCategorysEnum().APPLICATION,
	    model.GetAccessConfigWindowsLogInfoUpdateCategorysEnum().SYSTEM,
    }
	windowsLogInfoAccessConfigDetail := &model.AccessConfigWindowsLogInfoUpdate{
		Categorys: &listCategorysWindowsLogInfo,
		TimeOffset: timeOffsetWindowsLogInfo,
		EventLevel: &listEventLevelWindowsLogInfo,
	}
	multiFormat := &model.AccessConfigFormatMutil{
		Mode: model.GetAccessConfigFormatMutilModeEnum().REGULAR,
		Value: "aaaa",
	}
	formatAccessConfigDetail := &model.AccessConfigFormatUpdate{
		Multi: multiFormat,
	}
	var listPathsAccessConfigDetail = []string{
        "/test/222",
	    "/test/111",
    }
	accessConfigDetailbody := &model.AccessConfigDeatilUpdate{
		Paths: &listPathsAccessConfigDetail,
		Format: formatAccessConfigDetail,
		WindowsLogInfo: windowsLogInfoAccessConfigDetail,
	}
	request.Body = &model.UpdateAccessConfigRequestBody{
		AccessConfigTag: &listAccessConfigTagbody,
		HostGroupInfo: hostGroupInfobody,
		AccessConfigDetail: accessConfigDetailbody,
		AccessConfigId: "ed90802a-8475-4702-955e-e3ee16a5dde9",
	}
	response, err := client.UpdateAccessConfig(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.

Modifying 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
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 UpdateAccessConfigSolution {

    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();
        UpdateAccessConfigRequest request = new UpdateAccessConfigRequest();
        UpdateAccessConfigRequestBody body = new UpdateAccessConfigRequestBody();
        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("de4dbed4-a3bc-4877-a7ee-096a2a63e036");
        AccessConfigHostGroupIdList hostGroupInfobody = new AccessConfigHostGroupIdList();
        hostGroupInfobody.withHostGroupIdList(listHostGroupInfoHostGroupIdList);
        List<AccessConfigWindowsLogInfoUpdate.EventLevelEnum> listWindowsLogInfoEventLevel = new ArrayList<>();
        listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoUpdate.EventLevelEnum.fromValue("information"));
        listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoUpdate.EventLevelEnum.fromValue("warning"));
        listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoUpdate.EventLevelEnum.fromValue("error"));
        listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoUpdate.EventLevelEnum.fromValue("critical"));
        listWindowsLogInfoEventLevel.add(AccessConfigWindowsLogInfoUpdate.EventLevelEnum.fromValue("verbose"));
        AccessConfigTimeOffsetCreate timeOffsetWindowsLogInfo = new AccessConfigTimeOffsetCreate();
        timeOffsetWindowsLogInfo.withOffset(7L)
            .withUnit(AccessConfigTimeOffsetCreate.UnitEnum.fromValue("day"));
        List<AccessConfigWindowsLogInfoUpdate.CategorysEnum> listWindowsLogInfoCategorys = new ArrayList<>();
        listWindowsLogInfoCategorys.add(AccessConfigWindowsLogInfoUpdate.CategorysEnum.fromValue("Application"));
        listWindowsLogInfoCategorys.add(AccessConfigWindowsLogInfoUpdate.CategorysEnum.fromValue("System"));
        AccessConfigWindowsLogInfoUpdate windowsLogInfoAccessConfigDetail = new AccessConfigWindowsLogInfoUpdate();
        windowsLogInfoAccessConfigDetail.withCategorys(listWindowsLogInfoCategorys)
            .withTimeOffset(timeOffsetWindowsLogInfo)
            .withEventLevel(listWindowsLogInfoEventLevel);
        AccessConfigFormatMutil multiFormat = new AccessConfigFormatMutil();
        multiFormat.withMode(AccessConfigFormatMutil.ModeEnum.fromValue("regular"))
            .withValue("aaaa");
        AccessConfigFormatUpdate formatAccessConfigDetail = new AccessConfigFormatUpdate();
        formatAccessConfigDetail.withMulti(multiFormat);
        List<String> listAccessConfigDetailPaths = new ArrayList<>();
        listAccessConfigDetailPaths.add("/test/222");
        listAccessConfigDetailPaths.add("/test/111");
        AccessConfigDeatilUpdate accessConfigDetailbody = new AccessConfigDeatilUpdate();
        accessConfigDetailbody.withPaths(listAccessConfigDetailPaths)
            .withFormat(formatAccessConfigDetail)
            .withWindowsLogInfo(windowsLogInfoAccessConfigDetail);
        body.withAccessConfigTag(listbodyAccessConfigTag);
        body.withHostGroupInfo(hostGroupInfobody);
        body.withAccessConfigDetail(accessConfigDetailbody);
        body.withAccessConfigId("ed90802a-8475-4702-955e-e3ee16a5dde9");
        request.withBody(body);
        try {
            UpdateAccessConfigResponse response = client.updateAccessConfig(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());
        }
    }
}

Modifying 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
# 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 = UpdateAccessConfigRequest()
        listAccessConfigTagbody = [
            AccessConfigTag(
                key="xxx",
                value="xxx"
            ),
            AccessConfigTag(
                key="xxx1",
                value="xxx1"
            )
        ]
        listHostGroupIdListHostGroupInfo = [
            "de4dbed4-a3bc-4877-a7ee-096a2a63e036"
        ]
        hostGroupInfobody = AccessConfigHostGroupIdList(
            host_group_id_list=listHostGroupIdListHostGroupInfo
        )
        listEventLevelWindowsLogInfo = [
            "information",
            "warning",
            "error",
            "critical",
            "verbose"
        ]
        timeOffsetWindowsLogInfo = AccessConfigTimeOffsetCreate(
            offset=7,
            unit="day"
        )
        listCategorysWindowsLogInfo = [
            "Application",
            "System"
        ]
        windowsLogInfoAccessConfigDetail = AccessConfigWindowsLogInfoUpdate(
            categorys=listCategorysWindowsLogInfo,
            time_offset=timeOffsetWindowsLogInfo,
            event_level=listEventLevelWindowsLogInfo
        )
        multiFormat = AccessConfigFormatMutil(
            mode="regular",
            value="aaaa"
        )
        formatAccessConfigDetail = AccessConfigFormatUpdate(
            multi=multiFormat
        )
        listPathsAccessConfigDetail = [
            "/test/222",
            "/test/111"
        ]
        accessConfigDetailbody = AccessConfigDeatilUpdate(
            paths=listPathsAccessConfigDetail,
            format=formatAccessConfigDetail,
            windows_log_info=windowsLogInfoAccessConfigDetail
        )
        request.body = UpdateAccessConfigRequestBody(
            access_config_tag=listAccessConfigTagbody,
            host_group_info=hostGroupInfobody,
            access_config_detail=accessConfigDetailbody,
            access_config_id="ed90802a-8475-4702-955e-e3ee16a5dde9"
        )
        response = client.update_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)

Modifying 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
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.UpdateAccessConfigRequest{}
	keyAccessConfigTag:= "xxx"
	valueAccessConfigTag:= "xxx"
	keyAccessConfigTag1:= "xxx1"
	valueAccessConfigTag1:= "xxx1"
	var listAccessConfigTagbody = []model.AccessConfigTag{
        {
            Key: &keyAccessConfigTag,
            Value: &valueAccessConfigTag,
        },
        {
            Key: &keyAccessConfigTag1,
            Value: &valueAccessConfigTag1,
        },
    }
	var listHostGroupIdListHostGroupInfo = []string{
        "de4dbed4-a3bc-4877-a7ee-096a2a63e036",
    }
	hostGroupInfobody := &model.AccessConfigHostGroupIdList{
		HostGroupIdList: listHostGroupIdListHostGroupInfo,
	}
	var listEventLevelWindowsLogInfo = []model.AccessConfigWindowsLogInfoUpdateEventLevel{
        model.GetAccessConfigWindowsLogInfoUpdateEventLevelEnum().INFORMATION,
	    model.GetAccessConfigWindowsLogInfoUpdateEventLevelEnum().WARNING,
	    model.GetAccessConfigWindowsLogInfoUpdateEventLevelEnum().ERROR,
	    model.GetAccessConfigWindowsLogInfoUpdateEventLevelEnum().CRITICAL,
	    model.GetAccessConfigWindowsLogInfoUpdateEventLevelEnum().VERBOSE,
    }
	timeOffsetWindowsLogInfo := &model.AccessConfigTimeOffsetCreate{
		Offset: int64(7),
		Unit: model.GetAccessConfigTimeOffsetCreateUnitEnum().DAY,
	}
	var listCategorysWindowsLogInfo = []model.AccessConfigWindowsLogInfoUpdateCategorys{
        model.GetAccessConfigWindowsLogInfoUpdateCategorysEnum().APPLICATION,
	    model.GetAccessConfigWindowsLogInfoUpdateCategorysEnum().SYSTEM,
    }
	windowsLogInfoAccessConfigDetail := &model.AccessConfigWindowsLogInfoUpdate{
		Categorys: &listCategorysWindowsLogInfo,
		TimeOffset: timeOffsetWindowsLogInfo,
		EventLevel: &listEventLevelWindowsLogInfo,
	}
	multiFormat := &model.AccessConfigFormatMutil{
		Mode: model.GetAccessConfigFormatMutilModeEnum().REGULAR,
		Value: "aaaa",
	}
	formatAccessConfigDetail := &model.AccessConfigFormatUpdate{
		Multi: multiFormat,
	}
	var listPathsAccessConfigDetail = []string{
        "/test/222",
	    "/test/111",
    }
	accessConfigDetailbody := &model.AccessConfigDeatilUpdate{
		Paths: &listPathsAccessConfigDetail,
		Format: formatAccessConfigDetail,
		WindowsLogInfo: windowsLogInfoAccessConfigDetail,
	}
	request.Body = &model.UpdateAccessConfigRequestBody{
		AccessConfigTag: &listAccessConfigTagbody,
		HostGroupInfo: hostGroupInfobody,
		AccessConfigDetail: accessConfigDetailbody,
		AccessConfigId: "ed90802a-8475-4702-955e-e3ee16a5dde9",
	}
	response, err := client.UpdateAccessConfig(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

Ingestion configuration modified.

400

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

500

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

Error Codes

See Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback