alicloud logo
Alibaba Cloud v3.34.0, Mar 17 23

alicloud.cen.FlowLog

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 in 1.73.0+

Example Usage

Basic Usage

using System.Collections.Generic;
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 defaultInstance = new AliCloud.Cen.Instance("defaultInstance");

    var defaultProject = new AliCloud.Log.Project("defaultProject", new()
    {
        Description = "create by terraform",
    });

    var defaultStore = new AliCloud.Log.Store("defaultStore", new()
    {
        Project = defaultProject.Name,
        RetentionPeriod = 3650,
        ShardCount = 3,
        AutoSplit = true,
        MaxSplitShardCount = 60,
        AppendMeta = true,
    });

    var defaultFlowLog = new AliCloud.Cen.FlowLog("defaultFlowLog", new()
    {
        FlowLogName = "my-flowlog",
        CenId = defaultInstance.Id,
        ProjectName = defaultProject.Name,
        LogStoreName = defaultStore.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 {
		defaultInstance, err := cen.NewInstance(ctx, "defaultInstance", nil)
		if err != nil {
			return err
		}
		defaultProject, err := log.NewProject(ctx, "defaultProject", &log.ProjectArgs{
			Description: pulumi.String("create by terraform"),
		})
		if err != nil {
			return err
		}
		defaultStore, err := log.NewStore(ctx, "defaultStore", &log.StoreArgs{
			Project:            defaultProject.Name,
			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, "defaultFlowLog", &cen.FlowLogArgs{
			FlowLogName:  pulumi.String("my-flowlog"),
			CenId:        defaultInstance.ID(),
			ProjectName:  defaultProject.Name,
			LogStoreName: defaultStore.Name,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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.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) {
        var defaultInstance = new Instance("defaultInstance");

        var defaultProject = new Project("defaultProject", ProjectArgs.builder()        
            .description("create by terraform")
            .build());

        var defaultStore = new Store("defaultStore", StoreArgs.builder()        
            .project(defaultProject.name())
            .retentionPeriod(3650)
            .shardCount(3)
            .autoSplit(true)
            .maxSplitShardCount(60)
            .appendMeta(true)
            .build());

        var defaultFlowLog = new FlowLog("defaultFlowLog", FlowLogArgs.builder()        
            .flowLogName("my-flowlog")
            .cenId(defaultInstance.id())
            .projectName(defaultProject.name())
            .logStoreName(defaultStore.name())
            .build());

    }
}
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_instance = alicloud.cen.Instance("defaultInstance")
default_project = alicloud.log.Project("defaultProject", description="create by terraform")
default_store = alicloud.log.Store("defaultStore",
    project=default_project.name,
    retention_period=3650,
    shard_count=3,
    auto_split=True,
    max_split_shard_count=60,
    append_meta=True)
default_flow_log = alicloud.cen.FlowLog("defaultFlowLog",
    flow_log_name="my-flowlog",
    cen_id=default_instance.id,
    project_name=default_project.name,
    log_store_name=default_store.name)
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 defaultInstance = new alicloud.cen.Instance("defaultInstance", {});
const defaultProject = new alicloud.log.Project("defaultProject", {description: "create by terraform"});
const defaultStore = new alicloud.log.Store("defaultStore", {
    project: defaultProject.name,
    retentionPeriod: 3650,
    shardCount: 3,
    autoSplit: true,
    maxSplitShardCount: 60,
    appendMeta: true,
});
const defaultFlowLog = new alicloud.cen.FlowLog("defaultFlowLog", {
    flowLogName: "my-flowlog",
    cenId: defaultInstance.id,
    projectName: defaultProject.name,
    logStoreName: defaultStore.name,
});
resources:
  # Create a cen flowlog resource and use it to publish a route entry pointing to an ECS.
  defaultInstance:
    type: alicloud:cen:Instance
  defaultProject:
    type: alicloud:log:Project
    properties:
      description: create by terraform
  defaultStore:
    type: alicloud:log:Store
    properties:
      project: ${defaultProject.name}
      retentionPeriod: 3650
      shardCount: 3
      autoSplit: true
      maxSplitShardCount: 60
      appendMeta: true
  defaultFlowLog:
    type: alicloud:cen:FlowLog
    properties:
      flowLogName: my-flowlog
      cenId: ${defaultInstance.id}
      projectName: ${defaultProject.name}
      logStoreName: ${defaultStore.name}

Create FlowLog Resource

new FlowLog(name: string, args: FlowLogArgs, opts?: CustomResourceOptions);
@overload
def FlowLog(resource_name: 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)
@overload
def FlowLog(resource_name: str,
            args: FlowLogArgs,
            opts: Optional[ResourceOptions] = 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.

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.

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

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

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.