Show / Hide Table of Contents

Interface IAwsLogDriverProps

Specifies the awslogs log driver configuration options.

Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.AWS.ECS.dll
Syntax (csharp)
public interface IAwsLogDriverProps
Syntax (vb)
Public Interface IAwsLogDriverProps
Remarks

ExampleMetadata: infused

Examples
// Create a Task Definition for the Windows container to start
FargateTaskDefinition taskDefinition = new FargateTaskDefinition(this, "TaskDef", new FargateTaskDefinitionProps {
    RuntimePlatform = new RuntimePlatform {
        OperatingSystemFamily = OperatingSystemFamily.WINDOWS_SERVER_2019_CORE,
        CpuArchitecture = CpuArchitecture.X86_64
    },
    Cpu = 1024,
    MemoryLimitMiB = 2048
});

taskDefinition.AddContainer("windowsservercore", new ContainerDefinitionOptions {
    Logging = LogDriver.AwsLogs(new AwsLogDriverProps { StreamPrefix = "win-iis-on-fargate" }),
    PortMappings = new [] { new PortMapping { ContainerPort = 80 } },
    Image = ContainerImage.FromRegistry("mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019")
});

Synopsis

Properties

DatetimeFormat

This option defines a multiline start pattern in Python strftime format.

LogGroup

The log group to log to.

LogRetention

The number of days log events are kept in CloudWatch Logs when the log group is automatically created by this construct.

Mode

The delivery mode of log messages from the container to awslogs.

MultilinePattern

This option defines a multiline start pattern using a regular expression.

StreamPrefix

Prefix for the log streams.

Properties

DatetimeFormat

This option defines a multiline start pattern in Python strftime format.

virtual string DatetimeFormat { get; }
Property Value

System.String

Remarks

A log message consists of a line that matches the pattern and any following lines that don’t match the pattern. Thus the matched line is the delimiter between log messages.

Default: - No multiline matching.

LogGroup

The log group to log to.

virtual ILogGroup LogGroup { get; }
Property Value

ILogGroup

Remarks

Default: - A log group is automatically created.

LogRetention

The number of days log events are kept in CloudWatch Logs when the log group is automatically created by this construct.

virtual Nullable<RetentionDays> LogRetention { get; }
Property Value

System.Nullable<RetentionDays>

Remarks

Default: - Logs never expire.

Mode

The delivery mode of log messages from the container to awslogs.

virtual Nullable<AwsLogDriverMode> Mode { get; }
Property Value

System.Nullable<AwsLogDriverMode>

Remarks

Default: - AwsLogDriverMode.BLOCKING

MultilinePattern

This option defines a multiline start pattern using a regular expression.

virtual string MultilinePattern { get; }
Property Value

System.String

Remarks

A log message consists of a line that matches the pattern and any following lines that don’t match the pattern. Thus the matched line is the delimiter between log messages.

This option is ignored if datetimeFormat is also configured.

Default: - No multiline matching.

StreamPrefix

Prefix for the log streams.

string StreamPrefix { get; }
Property Value

System.String

Remarks

The awslogs-stream-prefix option allows you to associate a log stream with the specified prefix, the container name, and the ID of the Amazon ECS task to which the container belongs. If you specify a prefix with this option, then the log stream takes the following format:

 prefix-name/container-name/ecs-task-id
Back to top Generated by DocFX