ALIYUN::CEN::Flowlog

ALIYUN::CEN::Flowlog类型用于创建流日志。

语法

{
  "Type": "ALIYUN::CEN::Flowlog",
  "Properties": {
    "CenId": String,
    "Description": String,
    "FlowLogName": String,
    "Interval": Integer,
    "LogStoreName": String,
    "LogFormatString": String,
    "ProjectName": String,
    "TransitRouterAttachmentId": String,
    "Tags": List,
    "TransitRouterId": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

CenId

String

云企业网实例 ID。

Description

String

流日志的描述信息。

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

FlowLogName

String

流日志名称。

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

Interval

Integer

流日志捕获流量的捕获窗口时长。

单位:秒。取值:60 或 600。默认值:600。

LogStoreName

String

存储捕获流量的 Logstore。

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

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

    • 同一个 Project 下,Logstore 名称不可重复。

    • 只能包括小写字母、数字、短划线(-)和下划线(_)。

    • 必须以小写字母或者数字开头和结尾。

    • 长度为 3~63 字符。

LogFormatString

String

自定义流日志记录字段的字符串。

格式定义为: ${字段 1}${字段 2}${字段 3}...${字段 n}

  • 如果不填写则记录所有默认字段。

  • 如果使用了此字段,由于${srcaddr}${dstaddr}${bytes}是必选参数,则必须以${srcaddr}${dstaddr}${bytes}开头。所有支持的流日志字段参见配置流日志

ProjectName

String

存储捕获流量的 Project。

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

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

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

    • Project 名称必须全局唯一。

    • 只能包括小写字母、数字和短划线(-)。

    • 必须以小写字母或者数字开头和结尾。

    • 长度为 3~63 字符。

TransitRouterAttachmentId

String

VPC 连接、VPN 连接、VBR 连接、ECR 连接或跨地域连接 ID。

若需配置转发路由器实例的流日志,此字段不填值。

Tags

List

标签。

更多信息,请参考Tags属性

TransitRouterId

String

转发路由器实例 ID。

Tags语法

"Tags": [
  {
    "Value": String,
    "Key": String
  }
]

Tags属性

属性名称

类型

必须

允许更新

描述

约束

Key

String

标签键。

Value

String

标签值。

返回值

Fn::GetAtt

  • FlowLogVersion:流日志的版本。

  • TransitRouterAttachmentId:网络实例连接 ID。

  • Description:流日志的描述信息。

  • ProjectName:存储捕获流量的 Project 名称。

  • CreateTime:流日志的创建时间

  • FlowLogId:流日志 ID。

  • FlowLogName:流日志的名称。

  • LogStoreName:存储捕获流量的 LogStore 名称。

  • LogFormatString:自定义流日志记录格式的字符串。

  • CenId:云企业网实例 ID。

  • Tags:标签。

  • TransitRouterId:转发路由器实例 ID。

  • Interval:流日志捕获流量的捕获窗口时长。

示例

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  TransitRouterAttachmentId:
    Type: String
    Description:
      en: |-
        The ID of the VPC connection, VPN connection, VBR connection, ECR connection, or inter-region connection.
        If you create the flow log for a transfer router, skip this parameter.
    Required: false
  FlowLogName:
    Type: String
    Description:
      en: |-
        The flow log name.
        The name can be empty or 1 to 128 characters in length, and cannot start with http:// or https://.
    Required: false
    MinLength: 1
    MaxLength: 128
  Description:
    AssociationProperty: TextArea
    Type: String
    Description:
      en: |-
        The description of the flow log.
        The description is optional. If you enter a description, it must be 1 to 256 characters in length, and cannot start with http:// or https://.
    Required: false
    MinLength: 1
    MaxLength: 256
  LogStoreName:
    Type: String
    Description:
      en: |-
        The Logstore that stores the captured traffic data.
        * If a Logstore is already created in the selected region, enter the name of the Logstore.
        * If no Logstores are created in the selected region, enter a name and the system automatically creates a Logstore. The name of the Logstore. The name must meet the following requirements:
            ** The name must be unique in a project.
            ** The name can contain only lowercase letters, digits, hyphens (-), and underscores (_).
            ** The name must start and end with a lowercase letter or a digit.
            ** The name must be 3 to 63 characters in length.
    Required: false
    MinLength: 3
    MaxLength: 63
  ProjectName:
    Type: String
    Description:
      en: |-
        The project that stores the captured traffic data. 
        * If a project is already created in the selected region, enter the name of the project.
        * If no projects are created in the selected region, enter a name and the system automatically creates a project.
            The project name must be unique in a region. You cannot change the name after the project is created. The name must meet the following requirements:
                ** The name must be globally unique.
                ** The name can contain only lowercase letters, digits, and hyphens (-).
                ** The name must start and end with a lowercase letter or a digit.
                ** The name must be 3 to 63 characters in length.
    Required: false
    MinLength: 3
    MaxLength: 63
  LogFormatString:
    Type: String
    Description:
      en: |-
        The strings that define the fields in the flow log.
        Format: ${Field 1}${Field 2}${Field 3}...{Field n}
            * If you do not configure this parameter, all fields are included in the flow log.
            * If you configure this parameter, start the string with ${srcaddr}${dstaddr}${bytes} because ${srcaddr}${dstaddr}${bytes} are required variables.
    Required: false
  CenId:
    Type: String
    Description:
      en: The ID of the CEN instance.
    Required: true
  TransitRouterId:
    Type: String
    Description:
      en: The ID of the transit router.
    Required: false
  Interval:
    Type: Number
    Description:
      en: 'The time window for collecting log data. Unit: seconds. Valid values: 60 and 600. Default value: 600.'
    Required: false
    MinValue: 60
    MaxValue: 600
Resources:
  ExtensionResource:
    Type: ALIYUN::CEN::Flowlog
    Properties:
      TransitRouterAttachmentId:
        Ref: TransitRouterAttachmentId
      FlowLogName:
        Ref: FlowLogName
      Description:
        Ref: Description
      LogStoreName:
        Ref: LogStoreName
      ProjectName:
        Ref: ProjectName
      LogFormatString:
        Ref: LogFormatString
      CenId:
        Ref: CenId
      TransitRouterId:
        Ref: TransitRouterId
      Interval:
        Ref: Interval
Outputs:
  FlowLogVersion:
    Description: The flow log version.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - FlowLogVersion
  TransitRouterAttachmentId:
    Description: The ID of the VPC connection, VPN connection, VBR connection, ECR connection, or inter-region connection.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - TransitRouterAttachmentId
  Description:
    Description: The description of the flow log.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Description
  ProjectName:
    Description: The project that stores the captured traffic data.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ProjectName
  CreateTime:
    Description: The time when the flow log was created.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - CreateTime
  FlowLogId:
    Description: The ID of the flow log.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - FlowLogId
  FlowLogName:
    Description: The flow log name.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - FlowLogName
  LogStoreName:
    Description: The Logstore that stores the captured traffic data.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - LogStoreName
  LogFormatString:
    Description: The strings that define the fields in the flow log.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - LogFormatString
  CenId:
    Description: The ID of the CEN instance.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - CenId
  Tags:
    Description: The tag of the flow log.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Tags
  TransitRouterId:
    Description: The ID of the transit router.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - TransitRouterId
  Interval:
    Description: The time window for collecting log data.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Interval
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "TransitRouterAttachmentId": {
      "Type": "String",
      "Description": {
        "en": "The ID of the VPC connection, VPN connection, VBR connection, ECR connection, or inter-region connection.\nIf you create the flow log for a transfer router, skip this parameter."
      },
      "Required": false
    },
    "FlowLogName": {
      "Type": "String",
      "Description": {
        "en": "The flow log name.\nThe name can be empty or 1 to 128 characters in length, and cannot start with http:// or https://."
      },
      "Required": false,
      "MinLength": 1,
      "MaxLength": 128
    },
    "Description": {
      "AssociationProperty": "TextArea",
      "Type": "String",
      "Description": {
        "en": "The description of the flow log.\nThe description is optional. If you enter a description, it must be 1 to 256 characters in length, and cannot start with http:// or https://."
      },
      "Required": false,
      "MinLength": 1,
      "MaxLength": 256
    },
    "LogStoreName": {
      "Type": "String",
      "Description": {
        "en": "The Logstore that stores the captured traffic data.\n* If a Logstore is already created in the selected region, enter the name of the Logstore.\n* If no Logstores are created in the selected region, enter a name and the system automatically creates a Logstore. The name of the Logstore. The name must meet the following requirements:\n    ** The name must be unique in a project.\n    ** The name can contain only lowercase letters, digits, hyphens (-), and underscores (_).\n    ** The name must start and end with a lowercase letter or a digit.\n    ** The name must be 3 to 63 characters in length."
      },
      "Required": false,
      "MinLength": 3,
      "MaxLength": 63
    },
    "ProjectName": {
      "Type": "String",
      "Description": {
        "en": "The project that stores the captured traffic data. \n* If a project is already created in the selected region, enter the name of the project.\n* If no projects are created in the selected region, enter a name and the system automatically creates a project.\n    The project name must be unique in a region. You cannot change the name after the project is created. The name must meet the following requirements:\n        ** The name must be globally unique.\n        ** The name can contain only lowercase letters, digits, and hyphens (-).\n        ** The name must start and end with a lowercase letter or a digit.\n        ** The name must be 3 to 63 characters in length."
      },
      "Required": false,
      "MinLength": 3,
      "MaxLength": 63
    },
    "LogFormatString": {
      "Type": "String",
      "Description": {
        "en": "The strings that define the fields in the flow log.\nFormat: ${Field 1}${Field 2}${Field 3}...{Field n}\n    * If you do not configure this parameter, all fields are included in the flow log.\n    * If you configure this parameter, start the string with ${srcaddr}${dstaddr}${bytes} because ${srcaddr}${dstaddr}${bytes} are required variables."
      },
      "Required": false
    },
    "CenId": {
      "Type": "String",
      "Description": {
        "en": "The ID of the CEN instance."
      },
      "Required": true
    },
    "TransitRouterId": {
      "Type": "String",
      "Description": {
        "en": "The ID of the transit router."
      },
      "Required": false
    },
    "Interval": {
      "Type": "Number",
      "Description": {
        "en": "The time window for collecting log data. Unit: seconds. Valid values: 60 and 600. Default value: 600."
      },
      "Required": false,
      "MinValue": 60,
      "MaxValue": 600
    }
  },
  "Resources": {
    "ExtensionResource": {
      "Type": "ALIYUN::CEN::Flowlog",
      "Properties": {
        "TransitRouterAttachmentId": {
          "Ref": "TransitRouterAttachmentId"
        },
        "FlowLogName": {
          "Ref": "FlowLogName"
        },
        "Description": {
          "Ref": "Description"
        },
        "LogStoreName": {
          "Ref": "LogStoreName"
        },
        "ProjectName": {
          "Ref": "ProjectName"
        },
        "LogFormatString": {
          "Ref": "LogFormatString"
        },
        "CenId": {
          "Ref": "CenId"
        },
        "TransitRouterId": {
          "Ref": "TransitRouterId"
        },
        "Interval": {
          "Ref": "Interval"
        }
      }
    }
  },
  "Outputs": {
    "FlowLogVersion": {
      "Description": "The flow log version.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "FlowLogVersion"
        ]
      }
    },
    "TransitRouterAttachmentId": {
      "Description": "The ID of the VPC connection, VPN connection, VBR connection, ECR connection, or inter-region connection.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "TransitRouterAttachmentId"
        ]
      }
    },
    "Description": {
      "Description": "The description of the flow log.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Description"
        ]
      }
    },
    "ProjectName": {
      "Description": "The project that stores the captured traffic data.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ProjectName"
        ]
      }
    },
    "CreateTime": {
      "Description": "The time when the flow log was created.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "CreateTime"
        ]
      }
    },
    "FlowLogId": {
      "Description": "The ID of the flow log.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "FlowLogId"
        ]
      }
    },
    "FlowLogName": {
      "Description": "The flow log name.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "FlowLogName"
        ]
      }
    },
    "LogStoreName": {
      "Description": "The Logstore that stores the captured traffic data.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "LogStoreName"
        ]
      }
    },
    "LogFormatString": {
      "Description": "The strings that define the fields in the flow log.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "LogFormatString"
        ]
      }
    },
    "CenId": {
      "Description": "The ID of the CEN instance.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "CenId"
        ]
      }
    },
    "Tags": {
      "Description": "The tag of the flow log.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Tags"
        ]
      }
    },
    "TransitRouterId": {
      "Description": "The ID of the transit router.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "TransitRouterId"
        ]
      }
    },
    "Interval": {
      "Description": "The time window for collecting log data.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Interval"
        ]
      }
    }
  }
}