删除日志接入
功能介绍
删除日志接入
调用方法
请参见如何调用API。
URI
DELETE /v3/{project_id}/lts/access-config
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
项目ID,获取方式请参见:获取账号租户ID、项目资源集ID、日志组ID、日志流ID。 缺省值:None 最小长度:32 最大长度:32 |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
String |
从IAM服务获取的用户Token,获取方式请参见:获取用户Token 缺省值:None 最小长度:1000 最大长度:2000 |
Content-Type |
是 |
String |
该字段填为:application/json;charset=UTF-8。 缺省值:None 最小长度:30 最大长度:30 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
access_config_id_list |
是 |
Array of strings |
日志接入ID列表 最小长度:36 最大长度:36 |
响应参数
状态码: 200
参数 |
参数类型 |
描述 |
---|---|---|
result |
Array of AccessConfigInfo objects |
日志接入列表 |
total |
Long |
日志接入总数 最小值:0 最大值:1000 |
参数 |
参数类型 |
描述 |
---|---|---|
access_config_id |
String |
日志接入ID 最小长度:36 最大长度:36 |
access_config_name |
String |
日志接入名称 最小长度:1 最大长度:64 |
access_config_type |
String |
日志接入类型。AGENT:主机接入 枚举值:
|
create_time |
Long |
创建时间 最小值:1 最大值:9999999999999 |
access_config_detail |
AccessConfigDeatilCreate object |
日志接入详细信息 |
log_info |
AccessConfigQueryLogInfo object |
日志接入日志详情 |
host_group_info |
AccessConfigHostGroupIdList object |
日志接入主机组ID列表 |
access_config_tag |
Array of accessConfigTag objects |
标签信息。KEY不能重复,最多20个标签 |
log_split |
Boolean |
日志拆分 |
binary_collect |
Boolean |
二进制收集 |
cluster_id |
String |
CCE集群ID |
参数 |
参数类型 |
描述 |
---|---|---|
paths |
Array of strings |
采集路径。
最小长度:1 最大长度:128 数组长度:1 - 9 |
black_paths |
Array of strings |
采集路径黑名单。
最小长度:1 最大长度:128 数组长度:0 - 9 |
format |
AccessConfigFormatCreate object |
日志格式。single与multi必须选择一种。 |
windows_log_info |
日志接入采集Windows事件日志 |
|
stdout |
Boolean |
标准输出开关,仅CCE接入类型时使用 |
stderr |
Boolean |
标准输出开关标准错误开关,仅CCE接入类型时使用 |
pathType |
String |
CCE接入类型,仅CCE接入类型时使用 枚举值:
|
namespaceRegex |
String |
K8s Namespace正则匹配,仅CCE接入类型时使用 |
podNameRegex |
String |
K8s Pod正则匹配,仅CCE接入类型时使用 |
containerNameRegex |
String |
K8s 容器名称正则匹配,仅CCE接入类型时使用 |
includeLabels |
Map<String,String> |
容器 Label白名单,最多支持创建30个,keyname不支持重名,仅CCE接入类型时使用 |
excludeLabels |
Map<String,String> |
容器 Label黑名单,最多支持创建30个,keyname不支持重名,仅CCE接入类型时使用 |
includeEnvs |
Map<String,String> |
环境变量白名单,最多支持创建30个,keyname不支持重名,仅CCE接入类型时使用 |
excludeEnvs |
Map<String,String> |
环境变量黑名单,最多支持创建30个,keyname不支持重名,仅CCE接入类型时使用 |
logLabels |
Map<String,String> |
容器 Label日志标签,最多支持创建30个,keyname不支持重名,仅CCE接入类型时使用 |
logEnvs |
Map<String,String> |
环境变量日志标签,最多支持创建30个,keyname不支持重名,仅CCE接入类型时使用 |
includeK8sLabels |
Map<String,String> |
K8s Label白名单,最多支持创建30个,keyname不支持重名,仅CCE接入类型时使用 |
excludeK8sLabels |
Map<String,String> |
K8s Label黑名单,最多支持创建30个,keyname不支持重名,仅CCE接入类型时使用 |
logK8s |
Map<String,String> |
K8s Label日志标签,最多支持创建30个,keyname不支持重名,仅CCE接入类型时使用 |
参数 |
参数类型 |
描述 |
---|---|---|
mode |
String |
单行日志。system:系统时间,wildcard:时间通配符。 枚举值:
|
value |
String |
日志时间。当mode为”system”,则填入当前时间戳。当mode为"wildcard",则时间通配符:用日志打印时间来标识一条日志数据,通过时间通配符来匹配日志,每条日志的行首显示日志的打印时间;如果日志中的时间格式为:2019-01-01 23:59:59,时间通配符应该填写为:YYYY-MM-DD hh:mm:ss;如果日志中的时间格式为:19-1-1 23:59:59,时间通配符应该填写为:YY-M-D hh:mm:ss 最小长度:1 最大长度:64 |
参数 |
参数类型 |
描述 |
---|---|---|
mode |
String |
单行日志。time:日志时间,regular:正则模式。 枚举值:
|
value |
String |
日志时间。当mode为"regular",则输入正则表达式当mode为"time",则时间通配符:用日志打印时间来标识一条日志数据,通过时间通配符来匹配日志,每条日志的行首显示日志的打印时间;如果日志中的时间格式为:2019-01-01 23:59:59,时间通配符应该填写为:YYYY-MM-DD hh:mm:ss;如果日志中的时间格式为:19-1-1 23:59:59,时间通配符应该填写为:YY-M-D hh:mm:ss 最小长度:1 最大长度:64 |
参数 |
参数类型 |
描述 |
---|---|---|
categorys |
Array of strings |
采集Windows事件日志类型。Application:应用系统,System:系统,Security:安全,Setup:启动 枚举值:
|
time_offset |
AccessConfigTimeOffset object |
日志接入偏移时间 |
event_level |
Array of strings |
事件等级。information:info,warning:告警,error:错误,critical:关键,verbose:冗长 数组长度:1 - 5 枚举值:
|
参数 |
参数类型 |
描述 |
---|---|---|
offset |
Long |
偏移时间。 当"unit"选择"day"时,范围为1~7天。 当"unit"选择"hour"时,范围为1~168小时。 当"unit"选择"sec"时,范围为1~604800秒。 最小值:1 最大值:604800 |
unit |
String |
偏移时间单位。day :天,hour:小时,sec:秒 枚举值:
|
参数 |
参数类型 |
描述 |
---|---|---|
log_group_id |
String |
日志组ID 最小长度:36 最大长度:36 |
log_stream_id |
String |
日志流ID 最小长度:36 最大长度:36 |
log_group_name |
String |
日志组名称 最小长度:1 最大长度:128 |
log_stream_name |
String |
日志流名称 最小长度:1 最大长度:128 |
参数 |
参数类型 |
描述 |
---|---|---|
host_group_id_list |
Array of strings |
主机组ID列表 最小长度:36 最大长度:36 |
参数 |
参数类型 |
描述 |
---|---|---|
key |
String |
标签Key 最小长度:1 最大长度:128 |
value |
String |
标签Value 最小长度:0 最大长度:255 |
状态码: 400
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 最小长度:8 最大长度:8 |
error_msg |
String |
错误描述 最小长度:1 最大长度:1000 |
状态码: 500
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 最小长度:8 最大长度:8 |
error_msg |
String |
错误描述 最小长度:1 最大长度:1000 |
请求示例
删除日志接入
DELETE https://{endpoint}/v3/{project_id}/lts/access-config /v3/{project_id}/lts/access-config {"access_config_id_list":["xxxx","xxxx"]}
响应示例
状态码: 200
删除日志接入请求响应成功
{ "result" : [ { "access_config_detail" : { "black_paths" : [ "/wjy/hei/tesxxx", "/wjy/hei/tesxxx" ], "format" : { "single" : { "mode" : "wildcard", "value" : "1111" } }, "paths" : [ "/wjy/tesxxx", "/wjy/texxx", "/wjyxxxxx" ], "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-8xxxxx", "access_config_name" : "采集Wjyxxxxxt2", "access_config_tag" : [ { "key" : "xxx", "value" : "xxx" }, { "key" : "xxx1", "value" : "xxx1" } ], "access_config_type" : "AGENT", "create_time" : 1635043645628, "host_group_info" : { "host_group_id_list" : [ "de4dbed4-a3bc-4877-a7ee-0xxxxxx6" ] }, "log_info" : { "log_group_id" : "9a7e2183-2d6d-4732-9a9b-e89xxxxx0", "log_group_name" : "lts-groupxxxxxka", "log_stream_id" : "c4de0538-53e6-41fd-b951-a8xxxxx58d7", "log_stream_name" : "lts-topic-txxxxx" } } ], "total" : 1 }
状态码: 400
非法请求 建议根据error_msg直接修改该请求。
{ "error_code" : "LTS.1807", "error_msg" : "Invalid access config id" }
状态码: 500
表明服务端能被请求访问到,但是服务内部出错。
{ "error_code" : "LTS.0010", "error_msg" : "The system encountered an internal error" }
SDK代码示例
SDK代码示例如下。
删除日志接入
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 |
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.*; public class DeleteAccessConfigSolution { 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(); DeleteAccessConfigRequest request = new DeleteAccessConfigRequest(); try { DeleteAccessConfigResponse response = client.deleteAccessConfig(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()); } } } |
删除日志接入
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 |
# 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 = DeleteAccessConfigRequest() response = client.delete_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) |
删除日志接入
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 |
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.DeleteAccessConfigRequest{} response, err := client.DeleteAccessConfig(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
状态码 |
描述 |
---|---|
200 |
删除日志接入请求响应成功 |
400 |
非法请求 建议根据error_msg直接修改该请求。 |
500 |
表明服务端能被请求访问到,但是服务内部出错。 |
错误码
请参见错误码。