Method: projects.locations.vpcFlowLogsConfigs.showEffectiveFlowLogsConfigs

vpcFlowLogsConfigs.showEffectiveFlowLogsConfigs 会返回适用于指定资源的所有 VPC 流日志配置的列表。

HTTP 请求

GET https://networkmanagement.googleapis.com/v1/{parent=projects/*/locations/*}/vpcFlowLogsConfigs:showEffectiveFlowLogsConfigs

网址采用 gRPC 转码语法。

路径参数

参数
parent

string

必需。VpcFlowLogsConfig 的父资源,采用以下格式指定:projects/{projectId}/locations/global

必须对指定的资源 parent 具有以下 IAM 权限才能进行授权:

  • networkmanagement.vpcflowlogsconfigs.list

查询参数

参数
resource

string

必需。要获取有效 VPC 流日志配置的资源。资源必须与父级资源属于同一项目。资源必须是网络、子网、互连连接、VPN 隧道或项目。

pageSize

integer

可选。要返回的 EffectiveVpcFlowLogsConfigs 的数量。 默认值为 30。

pageToken

string

可选。来自先前的查询的页面令牌,如 nextPageToken 中返回的页面令牌。

filter

string

可选。列出与过滤条件表达式匹配的 EffectiveVpcFlowLogsConfigs。过滤表达式必须使用受支持的 CEL 逻辑运算符

请求正文

请求正文必须为空。

响应正文

vpcFlowLogsConfigs.showEffectiveFlowLogsConfigs 方法的响应。

如果成功,响应正文将包含结构如下的数据:

JSON 表示法
{
  "effectiveFlowLogsConfigs": [
    {
      object (EffectiveVpcFlowLogsConfig)
    }
  ],
  "nextPageToken": string,
  "unreachable": [
    string
  ]
}
字段
effectiveFlowLogsConfigs[]

object (EffectiveVpcFlowLogsConfig)

有效 VPC 流日志配置的列表。

nextPageToken

string

用于提取下一组配置的页面令牌。

unreachable[]

string

无法到达的位置(使用 - 查询所有位置时)。

授权范围

需要以下 OAuth 范围:

  • https://www.googleapis.com/auth/cloud-platform

如需了解详情,请参阅 Authentication Overview

EffectiveVpcFlowLogsConfig

用于为 GetEffectiveVpcFlowLogsConfig 请求生成响应的配置。

JSON 表示法
{
  "name": string,
  "metadataFields": [
    string
  ],
  "state": enum (State),
  "aggregationInterval": enum (AggregationInterval),
  "flowSampling": number,
  "metadata": enum (Metadata),
  "filterExpr": string,
  "crossProjectMetadata": enum (CrossProjectMetadata),

  // Union field target_resource can be only one of the following:
  "network": string,
  "subnet": string,
  "interconnectAttachment": string,
  "vpnTunnel": string
  // End of list of possible types for union field target_resource.
  "scope": enum (Scope)
}
字段
name

string

配置的唯一名称。名称可以采用以下格式之一:

  • 对于项目级配置:projects/{projectId}/locations/global/vpcFlowLogsConfigs/{vpcFlowLogsConfigId}

  • 对于组织级配置:organizations/{organization_id}/locations/global/vpcFlowLogsConfigs/{vpcFlowLogsConfigId}

  • 对于 Compute 配置,名称将是子网的路径:projects/{projectId}/regions/{region}/subnetworks/{subnet_id}

metadataFields[]

string

要包含在报告的 VPC 流日志中的自定义元数据字段。只有在“metadata”设置为 CUSTOM_METADATA 时,才能指定此字段。

state

enum (State)

VPC 流日志配置的状态。默认值为 ENABLED。创建新配置时,必须启用该字段。设置 state=DISABLED 会暂停相应配置的日志生成。

aggregationInterval

enum (AggregationInterval)

日志的汇总时间间隔。默认值为 INTERVAL_5_SEC。

flowSampling

number

该字段的值必须在 (0, 1] 范围内。VPC 流日志的采样率,其中 1.0 表示报告所有收集的日志。不允许将采样率设置为 0.0。如果您想停用 VPC 流日志,请改用 state 字段。默认值为 1.0。

metadata

enum (Metadata)

配置应将所有元数据字段还是部分元数据字段添加到报告的 VPC 流日志中,或者不应将任何元数据字段添加到报告的 VPC 流日志中。默认值为 INCLUDE_ALL_METADATA。

filterExpr

string

用于定义应记录哪些 VPC 流日志的导出过滤条件。

crossProjectMetadata

enum (CrossProjectMetadata)

确定是否在日志中包含跨项目注解。此字段仅适用于组织配置。如果未在组织配置中指定,则将设置为 CROSS_PROJECT_METADATA_ENABLED。

联合字段 target_resource。对配置范围资源的引用。也就是说,流量记录的范围。目标资源必须与配置属于同一项目。组织级配置不支持此字段。target_resource 只能是下列其中一项:
network

string

流量将从网络中的虚拟机、VPN 隧道和互连连接记录。格式:projects/{projectId}/global/networks/{name}

subnet

string

流量将从子网内的虚拟机记录。格式:projects/{projectId}/regions/{region}/subnetworks/{name}

interconnectAttachment

string

流量将从互连连接记录。格式:projects/{projectId}/regions/{region}/interconnectAttachments/{name}

vpnTunnel

string

流量将从 VPN 隧道记录。格式:projects/{projectId}/regions/{region}/vpnTunnels/{name}

scope

enum (Scope)

指定配置的范围(例如,子网、网络、组织等)。

范围

相应流日志配置的范围。

枚举
SCOPE_UNSPECIFIED 范围未指定。
SUBNET 目标资源是子网 (Network Management API)。
COMPUTE_API_SUBNET 目标资源是子网,配置源自 Compute API。
NETWORK 目标资源是网络。
VPN_TUNNEL 目标资源是 VPN 隧道。
INTERCONNECT_ATTACHMENT 目标资源是互连连接。
ORGANIZATION 配置适用于整个组织。