Querying Log Ingestion Configurations
Function
This API is used to query log ingestion configurations in LTS.
Calling Method
For details, see Calling APIs.
URI
POST /v3/{project_id}/lts/access-config-list
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain a project ID, see Obtaining the Account ID, Project Resource Set ID, Log Group ID, and Log Stream ID. Minimum: 32 Maximum: 32 |
Request Parameters
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 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
access_config_name_list |
Yes |
Array of strings |
List of ingestion configuration names. Minimum: 1 Maximum: 64 |
host_group_name_list |
Yes |
Array of strings |
List of host group names. Minimum: 1 Maximum: 64 |
log_group_name_list |
Yes |
Array of strings |
List of log group names. Minimum: 1 Maximum: 64 |
log_stream_name_list |
Yes |
Array of strings |
List of log stream names. Minimum: 1 Maximum: 64 |
access_config_tag_list |
No |
Array of accessConfigTag objects |
Ingestion configuration tags. A tag key must be unique. Up to 20 tags are supported. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
result |
Array of AccessConfigInfo objects |
Ingestion configuration list. |
total |
Long |
Total number of ingestion configurations. Minimum: 0 Maximum: 1000 |
Parameter |
Type |
Description |
---|---|---|
access_config_id |
String |
Ingestion configuration ID. Minimum: 36 Maximum: 36 |
access_config_name |
String |
Ingestion configuration name. Minimum: 1 Maximum: 64 |
access_config_type |
String |
Ingestion configuration type. The value AGENT indicates host log ingestion. Enumeration values:
|
create_time |
Long |
Creation time. Minimum: 1 Maximum: 9999999999999 |
access_config_detail |
AccessConfigDeatilCreate object |
Ingestion configuration details. |
log_info |
AccessConfigQueryLogInfo object |
Log details. |
host_group_info |
AccessConfigHostGroupIdList object |
Host group ID list. |
access_config_tag |
Array of accessConfigTag objects |
Tag information. A tag key must be unique. Up to 20 tags are supported. |
log_split |
Boolean |
Log splitting. |
binary_collect |
Boolean |
Binary collection. |
cluster_id |
String |
CCE cluster ID |
Parameter |
Type |
Description |
---|---|---|
paths |
Array of strings |
Collection paths.
Minimum: 1 Maximum: 128 Array Length: 1 - 9 |
black_paths |
Array of strings |
Collection path blacklist.
Minimum: 1 Maximum: 128 Array Length: 0 - 9 |
format |
AccessConfigFormatCreate object |
Log format. Set it to either single or multi. |
windows_log_info |
Windows event logs. |
|
stdout |
Boolean |
Standard output switch. This parameter is used only when logs are collected from CCE. |
stderr |
Boolean |
Standard error switch. This parameter is used only when logs are collected from CCE. |
pathType |
String |
Log collection from CCE. This parameter is used only when logs are collected from CCE. Enumeration values:
|
namespaceRegex |
String |
Regular expression matching of Kubernetes namespaces. This parameter is used only when logs are collected from CCE. |
podNameRegex |
String |
Regular expression matching of Kubernetes pods. This parameter is used only when logs are collected from CCE. |
containerNameRegex |
String |
Regular expression matching of Kubernetes container names. This parameter is used only when logs are collected from CCE. |
includeLabels |
Map<String,String> |
Container label trustlist. A maximum of 30 container labels can be created. The key names must be unique. This parameter is used only when logs are collected from CCE. |
excludeLabels |
Map<String,String> |
Container label blocklist. A maximum of 30 container labels can be created. The key names must be unique. This parameter is used only when logs are collected from CCE. |
includeEnvs |
Map<String,String> |
Environment variable trustlist. A maximum of 30 environment variable whitelists can be created. Key names must be unique. This parameter is used only when logs are collected from CCE. |
excludeEnvs |
Map<String,String> |
Environment variable blocklist. A maximum of 30 environment variables can be created. The key names must be unique. This parameter is used only when logs are collected from CCE. |
logLabels |
Map<String,String> |
Container label log tag. A maximum of 30 tags can be created. The key names must be unique. This parameter is used only when logs are collected from CCE. |
logEnvs |
Map<String,String> |
Environment variable log tag. A maximum of 30 tags can be created. The key name must be unique. This parameter is used only when logs are collected from CCE. |
includeK8sLabels |
Map<String,String> |
Kubernetes label trustlist. A maximum of 30 whitelists can be created. The key names must be unique. This parameter is used only when logs are collected from CCE. |
excludeK8sLabels |
Map<String,String> |
Kubernetes label blocklist. A maximum of 30 blocklists can be created. The key names must be unique. This parameter is used only when logs are collected from CCE. |
logK8s |
Map<String,String> |
Kubernetes label log tag. A maximum of 30 tags can be created. The key names must be unique. This parameter is used only when logs are collected from CCE. |
Parameter |
Type |
Description |
---|---|---|
single |
Single-line logs. |
|
multi |
Multi-line logs. |
Parameter |
Type |
Description |
---|---|---|
mode |
String |
Single-line logs. system indicates the system time, whereas wildcard indicates the time wildcard. Enumeration values:
|
value |
String |
Log time.If mode is system, the value is the current timestamp.If mode is wildcard, the value is a time wildcard, which is used by ICAgent to look for the log printing time as the beginning of a log event. If the time format in a log event is 2019-01-01 23:59:59, the time wildcard is YYYY-MM-DD hh:mm:ss. If the time format in a log event is 19-1-1 23:59:59, the time wildcard is YY-M-D hh:mm:ss. Minimum: 1 Maximum: 64 |
Parameter |
Type |
Description |
---|---|---|
mode |
String |
Single-line logs. time indicates a time wildcard is used to detect log boundaries, whereas regular indicates that a regular expression is used. Enumeration values:
|
value |
String |
Log time.If mode is regular, the value is a regular expression.If mode is time, the value is a time wildcard, which is used by ICAgent to look for the log printing time as the beginning of a log event. If the time format in a log event is 2019-01-01 23:59:59, the time wildcard is YYYY-MM-DD hh:mm:ss. If the time format in a log event is 19-1-1 23:59:59, the time wildcard is YY-M-D hh:mm:ss. Minimum: 1 Maximum: 64 |
Parameter |
Type |
Description |
---|---|---|
categorys |
Array of strings |
The type of Windows event logs to be collected. Application: application system; System: system; Security: security; Setup: startup Enumeration values:
|
time_offset |
AccessConfigTimeOffset object |
Time offset. |
event_level |
Array of strings |
Event level. information, warning, error, critical, verbose. Array Length: 1 - 5 Enumeration values:
|
Parameter |
Type |
Description |
---|---|---|
offset |
Long |
Time offset. When unit is day, the value ranges from 1 to 7. When unit is hour, the value ranges from 1 to 168. When unit is sec, the value ranges from 1 to 604800. Minimum: 1 Maximum: 604800 |
unit |
String |
Unit of the time offset. day, hour, sec. Enumeration values:
|
Parameter |
Type |
Description |
---|---|---|
log_group_id |
String |
Log group ID. Minimum: 36 Maximum: 36 |
log_stream_id |
String |
Log stream ID. Minimum: 36 Maximum: 36 |
log_group_name |
String |
Log group name. Minimum: 1 Maximum: 128 |
log_stream_name |
String |
Log stream name. Minimum: 1 Maximum: 128 |
Parameter |
Type |
Description |
---|---|---|
host_group_id_list |
Array of strings |
List of host group IDs. Minimum: 36 Maximum: 36 |
Parameter |
Type |
Description |
---|---|---|
key |
String |
Tag key. Minimum: 1 Maximum: 128 |
value |
String |
Tag value. Minimum: 0 Maximum: 255 |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code Minimum: 8 Maximum: 8 |
error_msg |
String |
Error description Minimum: 1 Maximum: 1000 |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code Minimum: 8 Maximum: 8 |
error_msg |
String |
Error description Minimum: 1 Maximum: 1000 |
Example Requests
Log ingestion configurations are filtered by the request body.
POST https://{endpoint}/v3/{project_id}/lts/access-config-list { "access_config_name_list" : [ "Collectionxx2", "22x", "2x", "CollectionWjxxxx" ], "host_group_name_list" : [ "wwxx" ], "log_group_name_list" : [ "lts-grxx", "lts-xx", "lts-gxx" ], "log_stream_name_list" : [ "lts-topixx", "lts-txx" ], "access_config_tag_list" : [ { "key" : "xxx", "value" : "xxx" }, { "key" : "xxx1", "value" : "xxx1" } ] }
Example Responses
Status code: 200
The query is successful.
{ "result" : [ { "access_config_detail" : { "containerNameRegex" : "my", "excludeEnvs" : { "h" : "8" }, "excludeK8sLabels" : { "e" : "5" }, "excludeLabels" : { "b" : "2" }, "format" : { "single" : { "mode" : "system", "value" : "1678969382000" } }, "includeEnvs" : { "g" : "7" }, "includeK8sLabels" : { "d30" : "4" }, "includeLabels" : { "a" : "1" }, "logEnvs" : { "i" : "9" }, "logK8s" : { "f" : "6" }, "logLabels" : { "c" : "3" }, "namespaceRegex" : "default", "pathType" : "container_stdout", "paths" : [ ], "podNameRegex" : "abc", "stderr" : false, "stdout" : true }, "access_config_id" : "c3152f88-8b06-4f7f-bbbe-129512f49f87", "access_config_name" : "myapinew322", "access_config_tag" : [ { "key" : "my01", "value" : "001" }, { "key" : "my02", "value" : "002" } ], "access_config_type" : "K8S_CCE", "binary_collect" : false, "create_time" : 1684467787996, "host_group_info" : { "host_group_id_list" : [ "12b0bbd1-4eda-456b-a641-647aa66bdeab" ] }, "log_info" : { "log_group_id" : "9575cb24-290c-478e-a5db-88d6d1dc513b", "log_group_name" : "my-group", "log_stream_id" : "3581bee9-8698-476e-a0ba-b0f310ed99cf", "log_stream_name" : "lts-topic-api" }, "log_split" : false }, { "access_config_detail" : { "containerNameRegex" : "my", "excludeEnvs" : { "h" : "8" }, "excludeK8sLabels" : { "e" : "5" }, "excludeLabels" : { "b" : "2" }, "format" : { "single" : { "mode" : "system", "value" : "1678969382000" } }, "includeEnvs" : { "g" : "7" }, "includeK8sLabels" : { "d10" : "4", "d" : "4", "d12" : "4", "d11" : "4", "d14" : "4", "d13" : "4", "d16" : "4", "d15" : "4", "d18" : "4", "d17" : "4", "d1" : "4", "d2" : "4", "d3" : "4", "d4" : "4", "d5" : "4", "d6" : "4", "d7" : "4", "d8" : "4", "d9" : "4" }, "includeLabels" : { "a" : "1" }, "logEnvs" : { "i" : "9" }, "logK8s" : { "f" : "6" }, "logLabels" : { "c" : "3" }, "namespaceRegex" : "default", "pathType" : "container_stdout", "paths" : [ ], "podNameRegex" : "abc", "stderr" : false, "stdout" : true }, "access_config_id" : "550cd738-7b16-4724-9c59-aba61bf16528", "access_config_name" : "myapinew32", "access_config_tag" : [ { "key" : "my01", "value" : "001" }, { "key" : "my02", "value" : "002" } ], "access_config_type" : "K8S_CCE", "binary_collect" : false, "create_time" : 1684463134956, "host_group_info" : { "host_group_id_list" : [ "12b0bbd1-4eda-456b-a641-647aa66bdeab" ] }, "log_info" : { "log_group_id" : "9575cb24-290c-478e-a5db-88d6d1dc513b", "log_group_name" : "my-group", "log_stream_id" : "3581bee9-8698-476e-a0ba-b0f310ed99cf", "log_stream_name" : "lts-topic-api" }, "log_split" : false } ], "total" : 2 }
Status code: 400
Invalid request. Modify the request based on the description in error_msg before a retry.
{ "error_code" : "LTS.1807", "error_msg" : "Invalid access config name" }
Status code: 500
The server has received the request but encountered an internal error.
{ "error_code" : "LTS.0010", "error_msg" : "The system encountered an internal error" }
SDK Sample Code
The SDK sample code is as follows.
Log ingestion configurations are filtered by the request body.
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 |
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 ListAccessConfigSolution { 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"); ICredential auth = new BasicCredentials() .withAk(ak) .withSk(sk); LtsClient client = LtsClient.newBuilder() .withCredential(auth) .withRegion(LtsRegion.valueOf("<YOUR REGION>")) .build(); ListAccessConfigRequest request = new ListAccessConfigRequest(); GetAccessConfigListRequestBody body = new GetAccessConfigListRequestBody(); List<AccessConfigTag> listbodyAccessConfigTagList = new ArrayList<>(); listbodyAccessConfigTagList.add( new AccessConfigTag() .withKey("xxx") .withValue("xxx") ); listbodyAccessConfigTagList.add( new AccessConfigTag() .withKey("xxx1") .withValue("xxx1") ); List<String> listbodyLogStreamNameList = new ArrayList<>(); listbodyLogStreamNameList.add("lts-topixx"); listbodyLogStreamNameList.add("lts-txx"); List<String> listbodyLogGroupNameList = new ArrayList<>(); listbodyLogGroupNameList.add("lts-grxx"); listbodyLogGroupNameList.add("lts-xx"); listbodyLogGroupNameList.add("lts-gxx"); List<String> listbodyHostGroupNameList = new ArrayList<>(); listbodyHostGroupNameList.add("wwxx"); List<String> listbodyAccessConfigNameList = new ArrayList<>(); listbodyAccessConfigNameList.add("Collectionxx2"); listbodyAccessConfigNameList.add("22x"); listbodyAccessConfigNameList.add("2x"); listbodyAccessConfigNameList.add("CollectionWjxxxx"); body.withAccessConfigTagList(listbodyAccessConfigTagList); body.withLogStreamNameList(listbodyLogStreamNameList); body.withLogGroupNameList(listbodyLogGroupNameList); body.withHostGroupNameList(listbodyHostGroupNameList); body.withAccessConfigNameList(listbodyAccessConfigNameList); request.withBody(body); try { ListAccessConfigResponse response = client.listAccessConfig(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()); } } } |
Log ingestion configurations are filtered by the request body.
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 |
# 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"] credentials = BasicCredentials(ak, sk) client = LtsClient.new_builder() \ .with_credentials(credentials) \ .with_region(LtsRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListAccessConfigRequest() listAccessConfigTagListbody = [ AccessConfigTag( key="xxx", value="xxx" ), AccessConfigTag( key="xxx1", value="xxx1" ) ] listLogStreamNameListbody = [ "lts-topixx", "lts-txx" ] listLogGroupNameListbody = [ "lts-grxx", "lts-xx", "lts-gxx" ] listHostGroupNameListbody = [ "wwxx" ] listAccessConfigNameListbody = [ "Collectionxx2", "22x", "2x", "CollectionWjxxxx" ] request.body = GetAccessConfigListRequestBody( access_config_tag_list=listAccessConfigTagListbody, log_stream_name_list=listLogStreamNameListbody, log_group_name_list=listLogGroupNameListbody, host_group_name_list=listHostGroupNameListbody, access_config_name_list=listAccessConfigNameListbody ) response = client.list_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) |
Log ingestion configurations are filtered by the request body.
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 |
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") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := lts.NewLtsClient( lts.LtsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListAccessConfigRequest{} keyAccessConfigTagList:= "xxx" valueAccessConfigTagList:= "xxx" keyAccessConfigTagList1:= "xxx1" valueAccessConfigTagList1:= "xxx1" var listAccessConfigTagListbody = []model.AccessConfigTag{ { Key: &keyAccessConfigTagList, Value: &valueAccessConfigTagList, }, { Key: &keyAccessConfigTagList1, Value: &valueAccessConfigTagList1, }, } var listLogStreamNameListbody = []string{ "lts-topixx", "lts-txx", } var listLogGroupNameListbody = []string{ "lts-grxx", "lts-xx", "lts-gxx", } var listHostGroupNameListbody = []string{ "wwxx", } var listAccessConfigNameListbody = []string{ "Collectionxx2", "22x", "2x", "CollectionWjxxxx", } request.Body = &model.GetAccessConfigListRequestBody{ AccessConfigTagList: &listAccessConfigTagListbody, LogStreamNameList: listLogStreamNameListbody, LogGroupNameList: listLogGroupNameListbody, HostGroupNameList: listHostGroupNameListbody, AccessConfigNameList: listAccessConfigNameListbody, } response, err := client.ListAccessConfig(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 query is successful. |
400 |
Invalid request. Modify the request based on the description in error_msg before a retry. |
500 |
The server has received the request but encountered an internal error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot