CreateFlowLog - 创建流日志

更新时间:
复制 MD 格式

创建流日志。

接口说明

CreateFlowLog 接口属于异步接口,即系统会返回一个实例 ID,但该流日志尚未创建完成,系统后台的创建任务仍在进行。您可以调用 DescribeFlowLogs 查询流日志的创建状态:

  • 当流日志处于 Activating 状态时,表示流日志正在创建中。

  • 当流日志处于 Active 状态时,表示流日志创建并启动完成。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

vpc:CreateFlowLog

create

VSwitch

acs:vpc:{#regionid}:{#accountId}:vswitch/{#VSwitchId}

*FlowLog

acs:vpc:{#regionId}:{#accountId}:flowlog/*

VPC

acs:vpc:{#regionId}:{#accountId}:vpc/{#VpcId}

请求参数

名称

类型

必填

描述

示例值

RegionId

string

流日志所属的地域 ID。您可以通过调用 DescribeRegions 接口获取地域 ID。

cn-qingdao

FlowLogName

string

流日志名称。

名称长度为 1~128 个字符,不能以http://https://开头。

myFlowlog

Description

string

流日志描述。

描述长度为 1~256 个字符,不能以http://https://开头。

This is my Flowlog.

ResourceType

string

要捕获流量的资源类型。取值:

  • NetworkInterface:弹性网卡。

  • VSwitch:交换机内的所有弹性网卡。

  • VPC:专有网络内的所有弹性网卡。

NetworkInterface

ResourceId

string

要捕获流量的资源 ID。

eni-askldfas****

TrafficType

string

采集的流量类型。取值:

  • All:全部流量。

  • Allow:访问控制允许的流量。

  • Drop:访问控制拒绝的流量。

All

ProjectName

string

管理捕获到的流量的 Project 名称。

  • Projec 名称仅支持小写字母、数字和短划线(-)。

  • 名称的开头与结尾必须为小写字母或数字。

  • 名称长度为 3~63 个字符。

FlowLogProject

LogStoreName

string

存储捕获到的流量的 LogStore 名称。

  • LogStore 名称仅支持小写字母、数字、短划线(-)和下划线(_)。

  • 名称的开头与结尾必须为小写字母或数字。

  • 名称长度为 3~63 个字符。

FlowLogStore

AggregationInterval

integer

流日志的采样间隔。单位:分钟。取值:1510(默认值)。

10

TrafficPath

array

采集的流量路径。取值:

  • all:表示全量采集。

  • internetGateway:表示公网流量采集。

string

采集的流量路径。取值:

  • all(默认值):表示全量采集。

说明

流量路径功能默认不开放,如需使用,请提交工单申请。

all

ResourceGroupId

string

资源组 ID。

rg-acfmxazdjdhd****

Tag

array<object>

资源的标签。

object

标签。

Key

string

资源的标签键。最多支持输入 20 个标签键。如需传入该值,请勿输入空字符串。

一个标签键最多支持 128 个字符,不能以aliyunacs:开头,不能包含http://或者https://

FinanceDept

Value

string

资源的标签值。最多支持输入 20 个标签值。如果传入该值,可以输入空字符串。

最多支持 128 个字符,不能以aliyunacs:开头,不能包含http://或者https://

FinanceJoshua

IpVersion

string

流日志采集流量的 IP 地址类型。

IPv4

返回参数

名称

类型

描述

示例值

object

请求 ID。

RequestId

string

请求 ID。

54B48E3D-DF70-471B-AA93-08E683A1B457

Success

string

是否调用成功。取值:

  • true:调用成功。

  • false:调用失败。

true

FlowLogId

string

流日志 ID。

fl-m5e8vhz2t21sel1nq****

ResourceGroupId

string

资源组 ID。

rg-acfmxazdjdhd****

示例

正常返回示例

JSON格式

{
  "RequestId": "54B48E3D-DF70-471B-AA93-08E683A1B457",
  "Success": "true",
  "FlowLogId": "fl-m5e8vhz2t21sel1nq****",
  "ResourceGroupId": "rg-acfmxazdjdhd****"
}

错误码

HTTP status code

错误码

错误信息

描述

400 IncorrectBusinessStatus.FlowLog The business status of flowLog is incorrect. 当前业务状态不支持创建流日志实例
400 OptInRequired.FlowLog You are not authorized to use the requested service of flowLog. Ensure that you have subscribed to the service you are trying to use. 您无权使用请求的 flowLog 服务。 确保您已经订阅了您尝试使用的服务。
400 OperationUnsupported.AdvancedFeature Advanced features of the vpc is unsupported. 不支持该高级特性。
400 InvalidInstanceId vswitch does not exist. vSwitch实例不存在。
400 ProjectOrLogstoreNotExist The specified project or logstore does not exist. 指定的项目或logstore不存在。
400 SourceProjectNotExist The Source Project or logstore does not exist. SLS源项目或日志库不存在。
400 Unauthorized This api does not support sub user or role. API不支持子用户或角色。
400 OperationUnsupported.action This action is not support. 此操作不支持。
400 ParameterInvalid Invalid parameter. 入参非法
400 RuleExist The rule has already existed.
400 InvalidHdMonitorStatus Current instance status is not valid for this action.
400 QuotaExceeded.FlowlogCount This user has reached the maximum instance number of flowlog. 已达到流日志的最大实例数。
400 InvalidResourceId.NotFound This resourceId already has flowlog instance existed. 要指定的资源已经存在flowlog实例
400 INVALID_PARAMETER The parameter invalid.
400 MissingParameter Missing mandatory parameter
400 InvalidRegionId.NotFound The RegionId provided does not exist in our records.
400 InvalidResourceType.NotFound Resource type no the same.
400 OperationUnsupported.ResourceType This resource type is not supported.
400 IllegalParam.AggregationInterval The param of aggregationInterval is illegal. 采样间隔参数输入不合法
400 UnsupportedFeature.UserDefinedTrafficPath The feature of UserDefinedTrafficPath is not supported. 本用户暂不支持自定义流日志trafficPath功能。
400 IllegalParam.TrafficPath The param of trafficPath is illegal. 传入的trafficPath参数非法。
400 DuplicatedParam.TrafficPath The param of trafficPath is duplicated. 传入的trafficPath参数中存在重复的数值。
400 IllegalParam.ResourceGroupId Invalid ResourceGroupld value. 指定的资源组非法或不存在
400 OperationDenied.OperateShareResource The operation is not allowed because of OperateShareResource. 操作共享资源导致操作失败
400 UnsupportedFeature.IpVersion The ipversion type is not supported. 输入的ipVersion不支持
400 UnsupportedFeature.VpcAdvancedFeature The VPC does not support some advanced features. VPC不支持某些高级功能,请提交工单处理。
400 OperationFailed.EniTypeNotSupport Operation failed because the ENI type is not supported. 弹性辅助网卡的类型不支持当前操作
400 IllegalParam.IpVersion The parameter of IpVersion is illegal. 参数IpVersion非法。
400 OperationDenied.NisTrafficAnalyzerAggregationIntervalMismatch The sampling interval of the FlowLog is greater than the sampling interval of the NIS Traffic Analyzer. FlowLog的采样间隔大于NIS流量分析器的采样间隔。
400 OperationDenied.NisTrafficAnalyzerNotFound The specified NIS Traffic Analyzer does not exist. 指定的NIS流量分析器不存在。
400 OperationDenied.NisTrafficAnalyzerNotActive The specified NIS Traffic Analyzer is not enabled. 指定的NIS流量分析器处于非开启状态。
400 OperationFailed.InternalError The request processing has failed due to some unknown error. 未知错误,请重试操作,错误仍存在请提交工单处理。
400 MissingParam.TrafficAnalyzerIdOrLogProjectOrLogStore TrafficAnalyzerId and ProjectName and LogStoreName parameters are not passed in. TrafficAnalyzerIdProjectNameLogStoreName 参数都未传入。
400 OperationDenied.AllTrafficPathOfManagedExist The resource you specified has created a flow log instance that collects the traffic of all scenarios. You cannot create a flow log instance that collects only some scenarios. 您指定的资源已经创建了采集全部场景的流量的流日志实例,不能再创建仅采集部分场景的流日志实例。
400 UnsupportedFeature.UserDefinedTrafficPathIpv6 Dual-stack flow log instances do not support custom trafficPath. 双栈流日志实例暂不支持自定义trafficPath功能。

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情