文档首页/ 安全云脑 SecMaster/ API参考/ 安全云脑 API V1/ 云服务接入/ 获取云服务采集配置 - ListCollectConfig
更新时间:2026-01-29 GMT+08:00
分享

获取云服务采集配置 - ListCollectConfig

功能介绍

获取云服务采集配置

调用方法

请参见如何调用API

授权信息

账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限,具体权限要求请参见权限和授权项

URI

GET /v1/{project_id}/collector/cloudlogs/config

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

参数解释:

项目ID,用于明确项目归属,配置后可通过该ID查询项目下资产,可以通过调用API获取,也可以从控制台获取。获取项目ID

约束限制:

不涉及

取值范围:

不涉及

默认取值:

不涉及

表2 Query参数

参数

是否必选

参数类型

描述

region_id

String

区域ID

offset

Long

第几页

limit

Long

每页数量

sort_key

String

排序字段

sort_dir

String

排序顺序

csvc

String

云服务

domain_id

String

账号ID

query_statistics

Boolean

是否查询云服务接入指标, 默认为 True

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释:

用户Token,通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。获取用户Token

约束限制:

不涉及

取值范围:

不涉及

默认取值:

不涉及

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

all_vendors

Array of all_vendors objects

所有的云厂商、云产品和日志

cofing_statistics

cofing_statistics object

统计数据

data_list

Array of data_list objects

数据

datasets

Array of DatasetInfo objects

数据集列表

dataspace_id

String

数据空间ID

dataspace_name

String

数据空间名称

domain_id

String

账号ID

lts_sets

Array of LtsResponseVo objects

lts日志配置

project_id

String

项目ID

region_id

String

所属region

workspace_id

String

工作空间 id

表5 all_vendors

参数

参数类型

描述

cloud_vendor

String

云厂商ID

csvc_list

Array of csvc_list objects

所有的云产品

表6 csvc_list

参数

参数类型

描述

csvc

String

云产品ID

source_list

Array of source_list objects

所有的日志类型

表7 source_list

参数

参数类型

描述

csvc_display

String

云产品名称

csvc_hzzelp

String

云产品描述

link

String

链接

source_display

String

日志名称

source_help

String

日志描述

表8 cofing_statistics

参数

参数类型

描述

account_num

Number

账号接入数量

daily_traffic

Number

每日流量,单位:Byte

log_num

Number

已接入日志数量

product_all_num

Number

云产品总数量

product_in_num

Number

接入云产品数量

vendor_num

Number

云厂商数量

表9 data_list

参数

参数类型

描述

account_all_num

Number

接入账号总数量

account_successful_num

Number

成功接入账号数量

csvc

String

云产品ID

datasets

Array of datasets objects

日志数据

last_modified_time

Number

上次修改时间

log_all_num

Number

日志总数量

log_in_num

Number

接入日志数量

log_in_num_last_one_hour

Number

过去一个小时接入

process_status

String

状态

vendor

String

云厂商ID

表10 datasets

参数

参数类型

描述

account_all_num

Number

接入账号总数量

account_successful_num

Number

成功接入账号数量

accounts

Array of accounts objects

账号列表

alert

Boolean

自动转告警开关

all_accounts

Boolean

是否接入已纳管的全量账号

allow_alert

Boolean

能否开自动转告警

dataspace_id

String

数据空间ID

dataspace_name

String

数据空间名称

enable

String

开启状态

last_active_time

Number

上次活跃时间

limit

String

限制

new_account_auto_access

Boolean

新账号自动接入开关

process_status

String

日志的接入状态,可能的值为FAIL,DEFAULT,CREATING,SUCCESS,FAIL表示失败,DEFAULT表示待接入,CREATING表示接入中,SUCCESS表示成功

reference

reference object

名称和描述

region_id

String

所属区域

sink_msg

String

错误信息

source_id

Number

日志ID

source_name

String

日志名称

target

target object

目标

type

String

类型

workspace_id

String

工作空间ID

表11 accounts

参数

参数类型

描述

account_id

String

账号ID

last_log_date

Number

最近接入时间

log_count

String

最近一小时接入数量

name

String

账号名称

process_status

String

接入状态

sink_msg

String

错误信息

表12 reference

参数

参数类型

描述

csvc_display

String

云产品名称

csvc_hzzelp

String

云产品描述

link

String

链接

source_display

String

日志名称

source_help

String

日志描述

表13 target

参数

参数类型

描述

pipe

String

管道

shards

Number

分片

storage_mode

String

存储模式

ttl

Number

ttl时间

表14 DatasetInfo

参数

参数类型

描述

csvc

String

所属云服务,例如主机安全就填写hss

enable

String

启用状态:0未启用;1启用

is_region

Long

位置信息:1 region;0 global

reference

reference object

数据源名称

source_id

Long

数据源ID

source_name

String

数据源名称

target

Object

目标管道信息

type

Long

订阅类型:1租户订阅;2租户行管订阅;3平台行管(当前都为1)

表15 reference

参数

参数类型

描述

csvc_display

String

云服务描述

source_display

String

数据源描述

link

String

链接

csvc_help

String

云服务帮助说明

source_help

String

数据源帮助说明

表16 TargetInfo

参数

参数类型

描述

pipe

String

管道名

shards

Long

所需分区数

ttl

Long

数据生命周期

表17 LtsResponseVo

参数

参数类型

描述

config_id

String

配置id

config_name

String

配置名称

enable

String

是否开启

log_group_id

String

日志组Id

log_stream_id

String

日志流ID

log_type

String

日志类型

log_types

log_types object

日志类型列表

lts_infos

Array of lts_infos objects

lts日志信息map

pipe_alias

String

管道别名

type_prefix

String

类型前缀

表18 log_types

参数

参数类型

描述

secm_lts_

Array of strings

类型前缀

表19 lts_infos

参数

参数类型

描述

log_group_id

String

日志组id

log_group_name

String

组名称

streams

Array of streams objects

流列表

表20 streams

参数

参数类型

描述

log_stream_id

String

日志流ID

log_stream_name

String

日志流名称

状态码:400

表21 响应Body参数

参数

参数类型

描述

error_code

String

错误码

error_msg

String

错误描述

请求示例

响应示例

状态码:200

成功

{
  "all_vendors" : [ {
    "cloud_vendor" : "SYSTEM",
    "csvc_list" : [ {
      "csvc" : "hss",
      "source_list" : [ {
        "csvc_display" : "主机告警",
        "csvc_hzzelp" : "HSS主机的主机告警",
        "link" : "hss.com",
        "source_display" : "主机",
        "source_help" : "HSS主机"
      } ]
    } ]
  } ],
  "cofing_statistics" : {
    "account_num" : 100,
    "daily_traffic" : 1024,
    "log_num" : 10,
    "product_all_num" : 8,
    "product_in_num" : 4,
    "vendor_num" : 2
  },
  "data_list" : [ {
    "account_all_num" : 100,
    "account_successful_num" : 30,
    "csvc" : "HSS",
    "datasets" : [ {
      "account_all_num" : 20,
      "account_successful_num" : 10,
      "accounts" : [ {
        "account_id" : "dd723a1e-43b4-4964-943c-e43fd1d1bef3",
        "last_log_date" : 1748355708341,
        "log_count" : 20,
        "name" : "h30043642",
        "process_status" : "FAIL",
        "sink_msg" : "Failed to access"
      } ],
      "alert" : true,
      "all_accounts" : true,
      "allow_alert" : true,
      "enable" : "ACTIVE",
      "last_active_time" : 1748355708341,
      "new_account_auto_access" : true,
      "process_status" : "FAIL",
      "region_id" : "region_c",
      "sink_msg" : "Failed to access",
      "source_id" : 101,
      "source_name" : "hss-alarm",
      "target" : {
        "pipe" : "_sec_waf_access",
        "shards" : 1,
        "ttl" : 180
      },
      "workspace_id" : "dd723a1e-43b4-4964-943c-e43fd1d1bef3"
    } ],
    "last_modified_time" : 1748355708341,
    "log_all_num" : 20,
    "log_in_num" : 30,
    "log_in_num_last_one_hour" : 10000,
    "process_status" : "SUCCESS",
    "vendor" : "SYSTEM"
  } ],
  "datasets" : [ {
    "csvc" : "hss",
    "enable" : 1,
    "is_region" : 1,
    "reference" : {
      "csvc_display" : "主机安全",
      "csvc_help" : "企业主机安全服务(Host Security Service,HSS)是提升主机整体安全性的服务",
      "link" : "cloud.com/xxx",
      "source_display" : "主机安全告警",
      "source_help" : "记录主机安全的告警"
    },
    "source_id" : 27,
    "source_name" : "hss_alarm",
    "target" : {
      "pipe" : "_sec_hss_alarm",
      "shards" : 1,
      "ttl" : 180
    },
    "type" : 1
  }, {
    "csvc" : "waf",
    "enable" : 1,
    "is_region" : 0,
    "reference" : {
      "csvc_display" : "web应用防火墙",
      "csvc_help" : "Web应用防火墙(Web Application Firewall,WAF),通过对HTTP(S)请求进行检测,识别并阻断SQL注入、跨站脚本攻击、网页木马上传、命令/代码注入,文件包含,敏感文件访问,第三方应用漏洞攻击,CC攻击,恶意爬虫扫描,跨站请求伪造等攻击,保护Web服务安全稳定.",
      "link" : "cloud.com/xxx",
      "source_display" : "WAF访问日志",
      "source_help" : "Web访问请求日志"
    },
    "source_id" : 28,
    "source_name" : "waf_access",
    "target" : {
      "pipe" : "_sec_waf_access",
      "shards" : 1,
      "ttl" : 180
    },
    "type" : 1
  } ],
  "dataspace_id" : "a00106ba-bede-453c-8488-b60c70bd6aed",
  "dataspace_name" : "cloudlogs_2b31ed520xxxxxxebedb6e57xxxxxxxx",
  "domain_id" : "0531ed520xxxxxxebedb6e57xxxxxxxx",
  "lts_sets" : [ {
    "config_name" : "测试云服务日志",
    "enable" : "ACTIVE",
    "log_group_id" : "d5c78cea-7c53-467e-b17e-344f2370b8e9",
    "log_stream_id" : "xxxx-cce5-46xxx89-8b8a-90d269f7db76",
    "log_type" : "apig",
    "log_types" : {
      "secm_lts_" : [ "apig" ]
    },
    "lts_infos" : [ {
      "log_group_id" : "d5c78cea-7c53-467e-b17e-344f2370b8e9",
      "log_group_name" : "aom-090-002",
      "streams" : [ {
        "log_stream_id" : "xxxx-cce5-46xxx89-8b8a-90d269f7db76",
        "log_stream_name" : "lts-xxxx-lmytest-0522-12"
      }, {
        "log_stream_id" : "7cdc28ce-xxxx-4f4b-9247-6edd42808f8a",
        "log_stream_name" : "lts-topic-test001002"
      } ]
    }, {
      "log_group_id" : "dd723a1e-43b4-4964-943c-e43fd1d1bef3",
      "log_group_name" : "lts-group-lmytest-0522-2",
      "streams" : [ {
        "log_stream_id" : "xxxx-cce5-46xxx89-8b8a-90d269f7db76",
        "log_stream_name" : "lts-xxxx-lmytest-0522-12"
      }, {
        "log_stream_id" : "7cdc28ce-xxxx-4f4b-9247-6edd42808f8a",
        "log_stream_name" : "lts-topic-test001002"
      } ]
    } ],
    "pipe_alias" : "测试",
    "type_prefix" : "secm_lts_"
  } ],
  "project_id" : "2b31ed520xxxxxxebedb6e57xxxxxxxx",
  "region_id" : "region_c",
  "workspace_id" : "c22106ba-bede-453c-8488-b60c70bd6aed"
}

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
46
47
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.secmaster.v1.region.SecMasterRegion;
import com.huaweicloud.sdk.secmaster.v1.*;
import com.huaweicloud.sdk.secmaster.v1.model.*;


public class ListCollectConfigSolution {

    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);

        SecMasterClient client = SecMasterClient.newBuilder()
                .withCredential(auth)
                .withRegion(SecMasterRegion.valueOf("<YOUR REGION>"))
                .build();
        ListCollectConfigRequest request = new ListCollectConfigRequest();
        try {
            ListCollectConfigResponse response = client.listCollectConfig(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
31
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdksecmaster.v1.region.secmaster_region import SecMasterRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdksecmaster.v1 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 = SecMasterClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(SecMasterRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListCollectConfigRequest()
        response = client.list_collect_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
36
37
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/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 := secmaster.NewSecMasterClient(
        secmaster.SecMasterClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListCollectConfigRequest{}
	response, err := client.ListCollectConfig(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

成功

400

错误响应

错误码

请参见错误码

相关文档