1. Packages
  2. Alicloud Provider
  3. API Docs
  4. cen
  5. FlowLog
Alibaba Cloud v3.65.1 published on Wednesday, Nov 13, 2024 by Pulumi

alicloud.cen.FlowLog

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.65.1 published on Wednesday, Nov 13, 2024 by Pulumi

    This resource used to create a flow log function in Cloud Enterprise Network (CEN). By using the flow log function, you can capture the traffic data of the network instances in different regions of a CEN. You can also use the data aggregated in flow logs to analyze cross-region traffic flows, minimize traffic costs, and troubleshoot network faults.

    For information about CEN flow log and how to use it, see Manage CEN flowlog.

    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.
    		_, 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,
                status: 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",
        Status = "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"),
    	Status:       pulumi.String("string"),
    })
    
    var flowLogResource = new FlowLog("flowLogResource", FlowLogArgs.builder()
        .cenId("string")
        .logStoreName("string")
        .projectName("string")
        .description("string")
        .flowLogName("string")
        .status("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",
        status="string")
    
    const flowLogResource = new alicloud.cen.FlowLog("flowLogResource", {
        cenId: "string",
        logStoreName: "string",
        projectName: "string",
        description: "string",
        flowLogName: "string",
        status: "string",
    });
    
    type: alicloud:cen:FlowLog
    properties:
        cenId: string
        description: string
        flowLogName: string
        logStoreName: string
        projectName: string
        status: 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
    The ID of the CEN Instance.
    LogStoreName string
    The name of the log store which is in the project_name SLS project.
    ProjectName string
    The name of the SLS project.
    Description string
    The description of flowlog.
    FlowLogName string
    The name of flowlog.
    Status string
    The status of flowlog. Valid values: ["Active", "Inactive"]. Default to "Active".
    CenId string
    The ID of the CEN Instance.
    LogStoreName string
    The name of the log store which is in the project_name SLS project.
    ProjectName string
    The name of the SLS project.
    Description string
    The description of flowlog.
    FlowLogName string
    The name of flowlog.
    Status string
    The status of flowlog. Valid values: ["Active", "Inactive"]. Default to "Active".
    cenId String
    The ID of the CEN Instance.
    logStoreName String
    The name of the log store which is in the project_name SLS project.
    projectName String
    The name of the SLS project.
    description String
    The description of flowlog.
    flowLogName String
    The name of flowlog.
    status String
    The status of flowlog. Valid values: ["Active", "Inactive"]. Default to "Active".
    cenId string
    The ID of the CEN Instance.
    logStoreName string
    The name of the log store which is in the project_name SLS project.
    projectName string
    The name of the SLS project.
    description string
    The description of flowlog.
    flowLogName string
    The name of flowlog.
    status string
    The status of flowlog. Valid values: ["Active", "Inactive"]. Default to "Active".
    cen_id str
    The ID of the CEN Instance.
    log_store_name str
    The name of the log store which is in the project_name SLS project.
    project_name str
    The name of the SLS project.
    description str
    The description of flowlog.
    flow_log_name str
    The name of flowlog.
    status str
    The status of flowlog. Valid values: ["Active", "Inactive"]. Default to "Active".
    cenId String
    The ID of the CEN Instance.
    logStoreName String
    The name of the log store which is in the project_name SLS project.
    projectName String
    The name of the SLS project.
    description String
    The description of flowlog.
    flowLogName String
    The name of flowlog.
    status String
    The status of flowlog. Valid values: ["Active", "Inactive"]. Default to "Active".

    Outputs

    All input properties are implicitly available as output properties. Additionally, the FlowLog resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    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,
            description: Optional[str] = None,
            flow_log_name: Optional[str] = None,
            log_store_name: Optional[str] = None,
            project_name: Optional[str] = None,
            status: Optional[str] = None) -> FlowLog
    func 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)
    Resource lookup is not supported in YAML
    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.
    The following state arguments are supported:
    CenId string
    The ID of the CEN Instance.
    Description string
    The description of flowlog.
    FlowLogName string
    The name of flowlog.
    LogStoreName string
    The name of the log store which is in the project_name SLS project.
    ProjectName string
    The name of the SLS project.
    Status string
    The status of flowlog. Valid values: ["Active", "Inactive"]. Default to "Active".
    CenId string
    The ID of the CEN Instance.
    Description string
    The description of flowlog.
    FlowLogName string
    The name of flowlog.
    LogStoreName string
    The name of the log store which is in the project_name SLS project.
    ProjectName string
    The name of the SLS project.
    Status string
    The status of flowlog. Valid values: ["Active", "Inactive"]. Default to "Active".
    cenId String
    The ID of the CEN Instance.
    description String
    The description of flowlog.
    flowLogName String
    The name of flowlog.
    logStoreName String
    The name of the log store which is in the project_name SLS project.
    projectName String
    The name of the SLS project.
    status String
    The status of flowlog. Valid values: ["Active", "Inactive"]. Default to "Active".
    cenId string
    The ID of the CEN Instance.
    description string
    The description of flowlog.
    flowLogName string
    The name of flowlog.
    logStoreName string
    The name of the log store which is in the project_name SLS project.
    projectName string
    The name of the SLS project.
    status string
    The status of flowlog. Valid values: ["Active", "Inactive"]. Default to "Active".
    cen_id str
    The ID of the CEN Instance.
    description str
    The description of flowlog.
    flow_log_name str
    The name of flowlog.
    log_store_name str
    The name of the log store which is in the project_name SLS project.
    project_name str
    The name of the SLS project.
    status str
    The status of flowlog. Valid values: ["Active", "Inactive"]. Default to "Active".
    cenId String
    The ID of the CEN Instance.
    description String
    The description of flowlog.
    flowLogName String
    The name of flowlog.
    logStoreName String
    The name of the log store which is in the project_name SLS project.
    projectName String
    The name of the SLS project.
    status String
    The status of flowlog. Valid values: ["Active", "Inactive"]. Default to "Active".

    Import

    CEN flowlog can be imported using the id, e.g.

    $ pulumi import alicloud:cen/flowLog:FlowLog default flowlog-tig1xxxxxx
    

    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 alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.65.1 published on Wednesday, Nov 13, 2024 by Pulumi