Class FlowLogOptions
Options to add a flow log to a VPC.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class FlowLogOptions : Object, IFlowLogOptions
Syntax (vb)
Public Class FlowLogOptions
Inherits Object
Implements IFlowLogOptions
Remarks
ExampleMetadata: infused
Examples
var vpc = new Vpc(this, "Vpc");
vpc.AddFlowLog("FlowLogS3", new FlowLogOptions {
Destination = FlowLogDestination.ToS3()
});
// Only reject traffic and interval every minute.
vpc.AddFlowLog("FlowLogCloudWatch", new FlowLogOptions {
TrafficType = FlowLogTrafficType.REJECT,
MaxAggregationInterval = FlowLogMaxAggregationInterval.ONE_MINUTE
});
Synopsis
Constructors
FlowLogOptions() |
Properties
Destination | Specifies the type of destination to which the flow log data is to be published. |
LogFormat | The fields to include in the flow log record, in the order in which they should appear. |
MaxAggregationInterval | The maximum interval of time during which a flow of packets is captured and aggregated into a flow log record. |
TrafficType | The type of traffic to log. |
Constructors
FlowLogOptions()
public FlowLogOptions()
Properties
Destination
Specifies the type of destination to which the flow log data is to be published.
public FlowLogDestination Destination { get; set; }
Property Value
Remarks
Flow log data can be published to CloudWatch Logs or Amazon S3
Default: FlowLogDestinationType.toCloudWatchLogs()
LogFormat
The fields to include in the flow log record, in the order in which they should appear.
public LogFormat[] LogFormat { get; set; }
Property Value
Remarks
If multiple fields are specified, they will be separated by spaces. For full control over the literal log format
string, pass a single field constructed with LogFormat.custom()
.
See https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html#flow-log-records
Default: - default log format is used.
MaxAggregationInterval
The maximum interval of time during which a flow of packets is captured and aggregated into a flow log record.
public Nullable<FlowLogMaxAggregationInterval> MaxAggregationInterval { get; set; }
Property Value
System.Nullable<FlowLogMaxAggregationInterval>
Remarks
When creating flow logs for a Transit Gateway or Transit Gateway Attachment, this property must be ONE_MINUTES.
Default: - FlowLogMaxAggregationInterval.ONE_MINUTES if creating flow logs for Transit Gateway, otherwise FlowLogMaxAggregationInterval.TEN_MINUTES.
TrafficType
The type of traffic to log.
public Nullable<FlowLogTrafficType> TrafficType { get; set; }
Property Value
System.Nullable<FlowLogTrafficType>
Remarks
You can log traffic that the resource accepts or rejects, or all traffic.
When the target is either TransitGateway
or TransitGatewayAttachment
, setting the traffic type is not possible.
Default: ALL
See: https://docs.aws.amazon.com/vpc/latest/tgw/working-with-flow-logs.html