alicloud.cen.FlowLog
Explore with Pulumi AI
Provides a CEN Flow Log resource.
For information about CEN Flow Log and how to use it, see What is Flow Log.
NOTE: Available since v1.73.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
// Create a cen flowlog resource and use it to publish a route entry pointing to an ECS.
const _default = new alicloud.cen.Instance("default", {name: "my-cen"});
const defaultProject = new alicloud.log.Project("default", {
    name: "sls-for-flowlog",
    description: "create by terraform",
});
const defaultStore = new alicloud.log.Store("default", {
    project: defaultProject.name,
    name: "sls-for-flowlog",
    retentionPeriod: 3650,
    shardCount: 3,
    autoSplit: true,
    maxSplitShardCount: 60,
    appendMeta: true,
});
const defaultFlowLog = new alicloud.cen.FlowLog("default", {
    flowLogName: "my-flowlog",
    cenId: _default.id,
    projectName: defaultProject.name,
    logStoreName: defaultStore.name,
});
import pulumi
import pulumi_alicloud as alicloud
# Create a cen flowlog resource and use it to publish a route entry pointing to an ECS.
default = alicloud.cen.Instance("default", name="my-cen")
default_project = alicloud.log.Project("default",
    name="sls-for-flowlog",
    description="create by terraform")
default_store = alicloud.log.Store("default",
    project=default_project.name,
    name="sls-for-flowlog",
    retention_period=3650,
    shard_count=3,
    auto_split=True,
    max_split_shard_count=60,
    append_meta=True)
default_flow_log = alicloud.cen.FlowLog("default",
    flow_log_name="my-flowlog",
    cen_id=default.id,
    project_name=default_project.name,
    log_store_name=default_store.name)
package main
import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cen"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/log"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// Create a cen flowlog resource and use it to publish a route entry pointing to an ECS.
		_default, err := cen.NewInstance(ctx, "default", &cen.InstanceArgs{
			Name: pulumi.String("my-cen"),
		})
		if err != nil {
			return err
		}
		defaultProject, err := log.NewProject(ctx, "default", &log.ProjectArgs{
			Name:        pulumi.String("sls-for-flowlog"),
			Description: pulumi.String("create by terraform"),
		})
		if err != nil {
			return err
		}
		defaultStore, err := log.NewStore(ctx, "default", &log.StoreArgs{
			Project:            defaultProject.Name,
			Name:               pulumi.String("sls-for-flowlog"),
			RetentionPeriod:    pulumi.Int(3650),
			ShardCount:         pulumi.Int(3),
			AutoSplit:          pulumi.Bool(true),
			MaxSplitShardCount: pulumi.Int(60),
			AppendMeta:         pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = cen.NewFlowLog(ctx, "default", &cen.FlowLogArgs{
			FlowLogName:  pulumi.String("my-flowlog"),
			CenId:        _default.ID(),
			ProjectName:  defaultProject.Name,
			LogStoreName: defaultStore.Name,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() => 
{
    // Create a cen flowlog resource and use it to publish a route entry pointing to an ECS.
    var @default = new AliCloud.Cen.Instance("default", new()
    {
        Name = "my-cen",
    });
    var defaultProject = new AliCloud.Log.Project("default", new()
    {
        Name = "sls-for-flowlog",
        Description = "create by terraform",
    });
    var defaultStore = new AliCloud.Log.Store("default", new()
    {
        Project = defaultProject.Name,
        Name = "sls-for-flowlog",
        RetentionPeriod = 3650,
        ShardCount = 3,
        AutoSplit = true,
        MaxSplitShardCount = 60,
        AppendMeta = true,
    });
    var defaultFlowLog = new AliCloud.Cen.FlowLog("default", new()
    {
        FlowLogName = "my-flowlog",
        CenId = @default.Id,
        ProjectName = defaultProject.Name,
        LogStoreName = defaultStore.Name,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.cen.Instance;
import com.pulumi.alicloud.cen.InstanceArgs;
import com.pulumi.alicloud.log.Project;
import com.pulumi.alicloud.log.ProjectArgs;
import com.pulumi.alicloud.log.Store;
import com.pulumi.alicloud.log.StoreArgs;
import com.pulumi.alicloud.cen.FlowLog;
import com.pulumi.alicloud.cen.FlowLogArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        // Create a cen flowlog resource and use it to publish a route entry pointing to an ECS.
        var default_ = new Instance("default", InstanceArgs.builder()
            .name("my-cen")
            .build());
        var defaultProject = new Project("defaultProject", ProjectArgs.builder()
            .name("sls-for-flowlog")
            .description("create by terraform")
            .build());
        var defaultStore = new Store("defaultStore", StoreArgs.builder()
            .project(defaultProject.name())
            .name("sls-for-flowlog")
            .retentionPeriod(3650)
            .shardCount(3)
            .autoSplit(true)
            .maxSplitShardCount(60)
            .appendMeta(true)
            .build());
        var defaultFlowLog = new FlowLog("defaultFlowLog", FlowLogArgs.builder()
            .flowLogName("my-flowlog")
            .cenId(default_.id())
            .projectName(defaultProject.name())
            .logStoreName(defaultStore.name())
            .build());
    }
}
resources:
  # Create a cen flowlog resource and use it to publish a route entry pointing to an ECS.
  default:
    type: alicloud:cen:Instance
    properties:
      name: my-cen
  defaultProject:
    type: alicloud:log:Project
    name: default
    properties:
      name: sls-for-flowlog
      description: create by terraform
  defaultStore:
    type: alicloud:log:Store
    name: default
    properties:
      project: ${defaultProject.name}
      name: sls-for-flowlog
      retentionPeriod: 3650
      shardCount: 3
      autoSplit: true
      maxSplitShardCount: 60
      appendMeta: true
  defaultFlowLog:
    type: alicloud:cen:FlowLog
    name: default
    properties:
      flowLogName: my-flowlog
      cenId: ${default.id}
      projectName: ${defaultProject.name}
      logStoreName: ${defaultStore.name}
Create FlowLog Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new FlowLog(name: string, args: FlowLogArgs, opts?: CustomResourceOptions);@overload
def FlowLog(resource_name: str,
            args: FlowLogArgs,
            opts: Optional[ResourceOptions] = None)
@overload
def FlowLog(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            cen_id: Optional[str] = None,
            log_store_name: Optional[str] = None,
            project_name: Optional[str] = None,
            description: Optional[str] = None,
            flow_log_name: Optional[str] = None,
            interval: Optional[int] = None,
            log_format_string: Optional[str] = None,
            status: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            transit_router_attachment_id: Optional[str] = None,
            transit_router_id: Optional[str] = None)func NewFlowLog(ctx *Context, name string, args FlowLogArgs, opts ...ResourceOption) (*FlowLog, error)public FlowLog(string name, FlowLogArgs args, CustomResourceOptions? opts = null)
public FlowLog(String name, FlowLogArgs args)
public FlowLog(String name, FlowLogArgs args, CustomResourceOptions options)
type: alicloud:cen:FlowLog
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args FlowLogArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args FlowLogArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args FlowLogArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args FlowLogArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args FlowLogArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var flowLogResource = new AliCloud.Cen.FlowLog("flowLogResource", new()
{
    CenId = "string",
    LogStoreName = "string",
    ProjectName = "string",
    Description = "string",
    FlowLogName = "string",
    Interval = 0,
    LogFormatString = "string",
    Status = "string",
    Tags = 
    {
        { "string", "string" },
    },
    TransitRouterAttachmentId = "string",
    TransitRouterId = "string",
});
example, err := cen.NewFlowLog(ctx, "flowLogResource", &cen.FlowLogArgs{
	CenId:           pulumi.String("string"),
	LogStoreName:    pulumi.String("string"),
	ProjectName:     pulumi.String("string"),
	Description:     pulumi.String("string"),
	FlowLogName:     pulumi.String("string"),
	Interval:        pulumi.Int(0),
	LogFormatString: pulumi.String("string"),
	Status:          pulumi.String("string"),
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	TransitRouterAttachmentId: pulumi.String("string"),
	TransitRouterId:           pulumi.String("string"),
})
var flowLogResource = new FlowLog("flowLogResource", FlowLogArgs.builder()
    .cenId("string")
    .logStoreName("string")
    .projectName("string")
    .description("string")
    .flowLogName("string")
    .interval(0)
    .logFormatString("string")
    .status("string")
    .tags(Map.of("string", "string"))
    .transitRouterAttachmentId("string")
    .transitRouterId("string")
    .build());
flow_log_resource = alicloud.cen.FlowLog("flowLogResource",
    cen_id="string",
    log_store_name="string",
    project_name="string",
    description="string",
    flow_log_name="string",
    interval=0,
    log_format_string="string",
    status="string",
    tags={
        "string": "string",
    },
    transit_router_attachment_id="string",
    transit_router_id="string")
const flowLogResource = new alicloud.cen.FlowLog("flowLogResource", {
    cenId: "string",
    logStoreName: "string",
    projectName: "string",
    description: "string",
    flowLogName: "string",
    interval: 0,
    logFormatString: "string",
    status: "string",
    tags: {
        string: "string",
    },
    transitRouterAttachmentId: "string",
    transitRouterId: "string",
});
type: alicloud:cen:FlowLog
properties:
    cenId: string
    description: string
    flowLogName: string
    interval: 0
    logFormatString: string
    logStoreName: string
    projectName: string
    status: string
    tags:
        string: string
    transitRouterAttachmentId: string
    transitRouterId: string
FlowLog Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The FlowLog resource accepts the following input properties:
- CenId string
- cen id
- LogStore stringName 
- The LogStore that stores the flowlog.
- ProjectName string
- The Project that stores the flowlog.
- Description string
- The description of the flowlog.
- FlowLog stringName 
- The name of the flowlog.
- Interval int
- The duration of the capture window for the flow log to capture traffic. Unit: seconds. Valid values: 60or **600 * *. Default value: **600 * *.
- LogFormat stringString 
- Log Format
- Status string
- The status of the flow log. Valid values:- Active: started.
- InActive: not started.
 
- Dictionary<string, string>
- The tag of the resource
- TransitRouter stringAttachment Id 
- Cross-region Connection ID or VBR connection ID. - NOTE: This parameter is required. 
- TransitRouter stringId 
- Transit Router ID
- CenId string
- cen id
- LogStore stringName 
- The LogStore that stores the flowlog.
- ProjectName string
- The Project that stores the flowlog.
- Description string
- The description of the flowlog.
- FlowLog stringName 
- The name of the flowlog.
- Interval int
- The duration of the capture window for the flow log to capture traffic. Unit: seconds. Valid values: 60or **600 * *. Default value: **600 * *.
- LogFormat stringString 
- Log Format
- Status string
- The status of the flow log. Valid values:- Active: started.
- InActive: not started.
 
- map[string]string
- The tag of the resource
- TransitRouter stringAttachment Id 
- Cross-region Connection ID or VBR connection ID. - NOTE: This parameter is required. 
- TransitRouter stringId 
- Transit Router ID
- cenId String
- cen id
- logStore StringName 
- The LogStore that stores the flowlog.
- projectName String
- The Project that stores the flowlog.
- description String
- The description of the flowlog.
- flowLog StringName 
- The name of the flowlog.
- interval Integer
- The duration of the capture window for the flow log to capture traffic. Unit: seconds. Valid values: 60or **600 * *. Default value: **600 * *.
- logFormat StringString 
- Log Format
- status String
- The status of the flow log. Valid values:- Active: started.
- InActive: not started.
 
- Map<String,String>
- The tag of the resource
- transitRouter StringAttachment Id 
- Cross-region Connection ID or VBR connection ID. - NOTE: This parameter is required. 
- transitRouter StringId 
- Transit Router ID
- cenId string
- cen id
- logStore stringName 
- The LogStore that stores the flowlog.
- projectName string
- The Project that stores the flowlog.
- description string
- The description of the flowlog.
- flowLog stringName 
- The name of the flowlog.
- interval number
- The duration of the capture window for the flow log to capture traffic. Unit: seconds. Valid values: 60or **600 * *. Default value: **600 * *.
- logFormat stringString 
- Log Format
- status string
- The status of the flow log. Valid values:- Active: started.
- InActive: not started.
 
- {[key: string]: string}
- The tag of the resource
- transitRouter stringAttachment Id 
- Cross-region Connection ID or VBR connection ID. - NOTE: This parameter is required. 
- transitRouter stringId 
- Transit Router ID
- cen_id str
- cen id
- log_store_ strname 
- The LogStore that stores the flowlog.
- project_name str
- The Project that stores the flowlog.
- description str
- The description of the flowlog.
- flow_log_ strname 
- The name of the flowlog.
- interval int
- The duration of the capture window for the flow log to capture traffic. Unit: seconds. Valid values: 60or **600 * *. Default value: **600 * *.
- log_format_ strstring 
- Log Format
- status str
- The status of the flow log. Valid values:- Active: started.
- InActive: not started.
 
- Mapping[str, str]
- The tag of the resource
- transit_router_ strattachment_ id 
- Cross-region Connection ID or VBR connection ID. - NOTE: This parameter is required. 
- transit_router_ strid 
- Transit Router ID
- cenId String
- cen id
- logStore StringName 
- The LogStore that stores the flowlog.
- projectName String
- The Project that stores the flowlog.
- description String
- The description of the flowlog.
- flowLog StringName 
- The name of the flowlog.
- interval Number
- The duration of the capture window for the flow log to capture traffic. Unit: seconds. Valid values: 60or **600 * *. Default value: **600 * *.
- logFormat StringString 
- Log Format
- status String
- The status of the flow log. Valid values:- Active: started.
- InActive: not started.
 
- Map<String>
- The tag of the resource
- transitRouter StringAttachment Id 
- Cross-region Connection ID or VBR connection ID. - NOTE: This parameter is required. 
- transitRouter StringId 
- Transit Router ID
Outputs
All input properties are implicitly available as output properties. Additionally, the FlowLog resource produces the following output properties:
- CreateTime string
- CreateTime
- Id string
- The provider-assigned unique ID for this managed resource.
- RegionId string
- region id
- CreateTime string
- CreateTime
- Id string
- The provider-assigned unique ID for this managed resource.
- RegionId string
- region id
- createTime String
- CreateTime
- id String
- The provider-assigned unique ID for this managed resource.
- regionId String
- region id
- createTime string
- CreateTime
- id string
- The provider-assigned unique ID for this managed resource.
- regionId string
- region id
- create_time str
- CreateTime
- id str
- The provider-assigned unique ID for this managed resource.
- region_id str
- region id
- createTime String
- CreateTime
- id String
- The provider-assigned unique ID for this managed resource.
- regionId String
- region id
Look up Existing FlowLog Resource
Get an existing FlowLog resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: FlowLogState, opts?: CustomResourceOptions): FlowLog@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        cen_id: Optional[str] = None,
        create_time: Optional[str] = None,
        description: Optional[str] = None,
        flow_log_name: Optional[str] = None,
        interval: Optional[int] = None,
        log_format_string: Optional[str] = None,
        log_store_name: Optional[str] = None,
        project_name: Optional[str] = None,
        region_id: Optional[str] = None,
        status: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        transit_router_attachment_id: Optional[str] = None,
        transit_router_id: Optional[str] = None) -> FlowLogfunc GetFlowLog(ctx *Context, name string, id IDInput, state *FlowLogState, opts ...ResourceOption) (*FlowLog, error)public static FlowLog Get(string name, Input<string> id, FlowLogState? state, CustomResourceOptions? opts = null)public static FlowLog get(String name, Output<String> id, FlowLogState state, CustomResourceOptions options)resources:  _:    type: alicloud:cen:FlowLog    get:      id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- CenId string
- cen id
- CreateTime string
- CreateTime
- Description string
- The description of the flowlog.
- FlowLog stringName 
- The name of the flowlog.
- Interval int
- The duration of the capture window for the flow log to capture traffic. Unit: seconds. Valid values: 60or **600 * *. Default value: **600 * *.
- LogFormat stringString 
- Log Format
- LogStore stringName 
- The LogStore that stores the flowlog.
- ProjectName string
- The Project that stores the flowlog.
- RegionId string
- region id
- Status string
- The status of the flow log. Valid values:- Active: started.
- InActive: not started.
 
- Dictionary<string, string>
- The tag of the resource
- TransitRouter stringAttachment Id 
- Cross-region Connection ID or VBR connection ID. - NOTE: This parameter is required. 
- TransitRouter stringId 
- Transit Router ID
- CenId string
- cen id
- CreateTime string
- CreateTime
- Description string
- The description of the flowlog.
- FlowLog stringName 
- The name of the flowlog.
- Interval int
- The duration of the capture window for the flow log to capture traffic. Unit: seconds. Valid values: 60or **600 * *. Default value: **600 * *.
- LogFormat stringString 
- Log Format
- LogStore stringName 
- The LogStore that stores the flowlog.
- ProjectName string
- The Project that stores the flowlog.
- RegionId string
- region id
- Status string
- The status of the flow log. Valid values:- Active: started.
- InActive: not started.
 
- map[string]string
- The tag of the resource
- TransitRouter stringAttachment Id 
- Cross-region Connection ID or VBR connection ID. - NOTE: This parameter is required. 
- TransitRouter stringId 
- Transit Router ID
- cenId String
- cen id
- createTime String
- CreateTime
- description String
- The description of the flowlog.
- flowLog StringName 
- The name of the flowlog.
- interval Integer
- The duration of the capture window for the flow log to capture traffic. Unit: seconds. Valid values: 60or **600 * *. Default value: **600 * *.
- logFormat StringString 
- Log Format
- logStore StringName 
- The LogStore that stores the flowlog.
- projectName String
- The Project that stores the flowlog.
- regionId String
- region id
- status String
- The status of the flow log. Valid values:- Active: started.
- InActive: not started.
 
- Map<String,String>
- The tag of the resource
- transitRouter StringAttachment Id 
- Cross-region Connection ID or VBR connection ID. - NOTE: This parameter is required. 
- transitRouter StringId 
- Transit Router ID
- cenId string
- cen id
- createTime string
- CreateTime
- description string
- The description of the flowlog.
- flowLog stringName 
- The name of the flowlog.
- interval number
- The duration of the capture window for the flow log to capture traffic. Unit: seconds. Valid values: 60or **600 * *. Default value: **600 * *.
- logFormat stringString 
- Log Format
- logStore stringName 
- The LogStore that stores the flowlog.
- projectName string
- The Project that stores the flowlog.
- regionId string
- region id
- status string
- The status of the flow log. Valid values:- Active: started.
- InActive: not started.
 
- {[key: string]: string}
- The tag of the resource
- transitRouter stringAttachment Id 
- Cross-region Connection ID or VBR connection ID. - NOTE: This parameter is required. 
- transitRouter stringId 
- Transit Router ID
- cen_id str
- cen id
- create_time str
- CreateTime
- description str
- The description of the flowlog.
- flow_log_ strname 
- The name of the flowlog.
- interval int
- The duration of the capture window for the flow log to capture traffic. Unit: seconds. Valid values: 60or **600 * *. Default value: **600 * *.
- log_format_ strstring 
- Log Format
- log_store_ strname 
- The LogStore that stores the flowlog.
- project_name str
- The Project that stores the flowlog.
- region_id str
- region id
- status str
- The status of the flow log. Valid values:- Active: started.
- InActive: not started.
 
- Mapping[str, str]
- The tag of the resource
- transit_router_ strattachment_ id 
- Cross-region Connection ID or VBR connection ID. - NOTE: This parameter is required. 
- transit_router_ strid 
- Transit Router ID
- cenId String
- cen id
- createTime String
- CreateTime
- description String
- The description of the flowlog.
- flowLog StringName 
- The name of the flowlog.
- interval Number
- The duration of the capture window for the flow log to capture traffic. Unit: seconds. Valid values: 60or **600 * *. Default value: **600 * *.
- logFormat StringString 
- Log Format
- logStore StringName 
- The LogStore that stores the flowlog.
- projectName String
- The Project that stores the flowlog.
- regionId String
- region id
- status String
- The status of the flow log. Valid values:- Active: started.
- InActive: not started.
 
- Map<String>
- The tag of the resource
- transitRouter StringAttachment Id 
- Cross-region Connection ID or VBR connection ID. - NOTE: This parameter is required. 
- transitRouter StringId 
- Transit Router ID
Import
CEN Flow Log can be imported using the id, e.g.
$ pulumi import alicloud:cen/flowLog:FlowLog example <id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the alicloudTerraform Provider.