文档

CreateFlowlog - 创建流日志

更新时间:

创建流日志。

接口说明

流日志可以帮您捕获转发路由器之间的跨地域流量信息和边界路由器 VBR(Virtual border router)连接的流量信息,在创建流日志前,请先了解以下说明:

  • 仅企业版转发路由器支持创建流日志。

  • 当前仅部分地域的流日志功能支持捕获 VBR 连接的流量信息。关于地域的信息,请参见使用限制

  • 对于跨地域连接的流量信息,流日志仅捕获转发路由器出方向的流量信息,不支持捕获转发路由器入方向的流量信息。

    例如,美国(硅谷)地域的云服务器 ECS(Elastic Compute Service)实例通过云企业网访问美国(弗吉尼亚)地域的 ECS 实例,在您为美国(弗吉尼亚)地域的转发路由器配置流日志后,您可以在日志服务控制台查看美国(弗吉尼亚)ECS 实例向美国(硅谷)ECS 实例发送的报文信息,但无法查看美国(硅谷)ECS 实例向美国(弗吉尼亚)ECS 实例发送的报文信息。如果您需要查看美国(硅谷)ECS 实例向美国(弗吉尼亚)ECS 实例发送的报文信息,您需要在美国(硅谷)地域的转发路由器上也配置流日志。

  • CreateFlowlog接口属于异步接口,即系统会先返回一个流日志 ID,但是流日志并未创建完成,系统后台的创建任务仍在进行。您可以调用DescribeFlowlogs接口查询流日志的状态。

    • 当流日志处于 Creating 状态时,表示流日志正在创建中,在该状态下,您只能执行查询操作,不能执行其他操作。
    • 当流日志处于 Active 状态时,表示流日志创建完成。

前提条件

在创建流日志前,请确保您已经创建了跨地域连接或者 VBR 连接。具体操作,请参见 CreateTransitRouterPeerAttachment 或者 CreateTransitRouterVbrAttachment

调试

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

授权信息

当前API暂无授权信息透出。

请求参数

名称类型必填描述示例值
ClientTokenstring

客户端 Token,用于保证请求的幂等性。

从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken 只支持 ASCII 字符。

说明 若您未指定,则系统自动使用 API 请求的 RequestId 作为 ClientToken 标识。每次 API 请求的 RequestId 可能不一样。
123e4567-e89b-12d3-a456-42665544****
RegionIdstring

流日志所属的地域 ID。

您可以通过调用 DescribeChildInstanceRegions 接口获取地域 ID。

cn-hangzhou
FlowLogNamestring

流日志名称。

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

myFlowlog
Descriptionstring

流日志的描述信息。

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

myFlowlog
CenIdstring

云企业网实例 ID。

cen-7qthudw0ll6jmc****
ProjectNamestring

存储捕获流量的 Project。

  • 如果您已经在当前地域创建了 Project,您可以输入已创建的 Project 的名称。

  • 如果您未在当前地域创建 Project,您可以为 Project 自定义名称,系统会帮您自动创建 Project。

    Project 名称在阿里云地域内全局唯一,创建后不可修改。其命名规则如下:

    • Project 名称必须全局唯一。
    • 只能包括小写字母、数字和短划线(-)。
    • 必须以小写字母或者数字开头和结尾。
    • 长度为 3~63 字符。
flowlog-project
LogStoreNamestring

存储捕获流量的 Logstore。

  • 如果您已经在当前地域创建了 Logstore,您可以输入已创建的 Logstore 的名称。

  • 如果您未在当前地域创建 Logstore,您可以为 Logstore 自定义名称,系统会帮您自动创建 Logstore。 Logstore 名称。其命名规则如下:

    • 同一个 Project 下,Logstore 名称不可重复。
    • 只能包括小写字母、数字、短划线(-)和下划线(_)。
    • 必须以小写字母或者数字开头和结尾。
    • 长度为 3~63 字符。
flowlog-logstore
Intervallong

流日志捕获流量的捕获窗口时长。单位:秒。取值:60600。默认值:600

600
TransitRouterAttachmentIdstring

跨地域连接 ID 或者 VBR 连接 ID。

说明 本参数为必填参数。
tr-attach-r6g0m3epjehw57****
Tagarray<object>

标签信息。

一次最多支持输入 20 个标签信息。

object
Keystring

资源的标签键。

一旦传入该值,则不允许为空字符串。最多支持 64 个字符,不能以aliyun或者acs:开头,不能包含http://或者https://

一次最多支持输入 20 个标签的标签键。

TagKey
Valuestring

资源的标签值。

标签值可以为空或输入不超过 128 个字符的字符串,不能以aliyun或者acs:开头,不能包含http://或者https://

每一个标签键对应一个标签值,一次最多支持输入 20 个标签键对应的标签值。

TagValue

返回参数

名称类型描述示例值
object

返回结果。

RequestIdstring

请求 ID。

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

当前接口调用是否成功。

  • true:成功。

  • false:失败。

true
FlowLogIdstring

流日志 ID。

flowlog-m5evbtbpt****

示例

正常返回示例

JSON格式

{
  "RequestId": "54B48E3D-DF70-471B-AA93-08E683A1B457",
  "Success": "true",
  "FlowLogId": "flowlog-m5evbtbpt****"
}

错误码

HTTP status code错误码错误信息描述
400ProjectOrLogstoreNotExistThe specified project or logstore does not exist.参数中指定的project或logstore不存在。
400SourceProjectNotExistThe Source Project or logstore does not exist.SourceProject或者logstore不存在。
400OperationUnsupported.actionThis action is not support.当前地域不支持该操作。
400RuleExistThe rule has already existed.该规则已存在。
400QuotaExceeded.FlowlogCountThis user has reached the maximum instance number of flowlog.flowlog数量已达到上限。
400InvalidFlowlogId.existThis cenId already has flowlog instance existed.当前Cen已经存在flowlog,无法操作。
400Flowlog.AlreayExistThis attachment already has existed flowlog instance.flowlog已存在,无法重复创建。
400IllegalParam.TransitRouterAttachmentIdTransitRouterAttachmentId is illegal.参数中指定的TrInstance不合法。
400InvalidTransitRouterAttachmentId.NotFoundThe TransitRouterAttachmentId is not found.参数中指定的TransitRouterAttachmentId不存在。
400IncorrectStatus.flowlogThis action is not allowed in the current flow log status.flowlog状态不正确
400InvalidOperation.TransitRouterNotExistOperation is invalid because the transit router not exist.转发路由器不存在。
400IncorrectStatus.TransitRouterAttachmentIdThe resource is not in a valid state for the attachment operation.当前该Attachment不处于稳态,不支持该操作。
400ProjectExistProject already exist, please try a different project name.日志Project已存在,请尝试使用不同的Project名称。
400InvalidParameter.ProjectNameProject name is invalid or does not belong to specified region.Project名称不合法或与不属于指定的region。
400IncorrectStatus.TrFlowlogFlowlog status for specified TransitRouter is invalid for this operation.指定转发路由器的流日志配置状态不合法。
400OperationInvalid.IncompatibleFlowlogExistOperation is invalid because incompatible flowlog config exists.存在不兼容的Flowlog配置,请删除后重试。
400InvalidParameter.LogFormatStringLogFormatString is invalid.指定的日志格式不合法。
400InvalidParameter.LogStoreNameSpecified LogStore name is invalid.Logstore名称不合法。
400InvalidParameter.ProjectNameProjectName is invalid.Project名称不合法。
400OperationFailed.InvalidLogInfoThe entered log service information is invalid. Check whether the ProjectName and LogStoreName are correct, and whether Log Service has been activated.输入的日志服务信息不合法。请确认ProjectName以及LogStoreName是否正确,并确认是否已开通日志服务。
400InvalidParameterInvalid parameter.参数不合法。
400UnauthorizedThe AccessKeyId is unauthorized.账号无权限操作。
403NoPermission.AliyunServiceRoleForTRFlowLogYou are not authorized to create service linked role AliyunServiceRoleForTRFlowLog.无权限创建服务关联角色AliyunServiceRoleForTRFlowLog。

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

变更历史

变更时间变更内容概要操作
2024-05-22OpenAPI 错误码发生变更查看变更详情
2023-01-03OpenAPI 错误码发生变更查看变更详情