AwsLogDriverProps Struct
Specifies the awslogs log driver configuration options.
| Source | aws-ecs/lib/log-drivers/aws-log-driver.ts |
|---|---|
| Type last changed |
Example
// Create a Task Definition for the Windows container to start
const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', {
runtimePlatform: {
operatingSystemFamily: ecs.OperatingSystemFamily.WINDOWS_SERVER_2019_CORE,
cpuArchitecture: ecs.CpuArchitecture.X86_64,
},
cpu: 1024,
memoryLimitMiB: 2048,
});
taskDefinition.addContainer('windowsservercore', {
logging: ecs.LogDriver.awsLogs({ streamPrefix: 'win-iis-on-fargate' }),
portMappings: [{ containerPort: 80 }],
image: ecs.ContainerImage.fromRegistry('mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019'),
});
# Create a Task Definition for the Windows container to start
task_definition = ecs.FargateTaskDefinition(self, "TaskDef",
runtime_platform=ecs.RuntimePlatform(
operating_system_family=ecs.OperatingSystemFamily.WINDOWS_SERVER_2019_CORE,
cpu_architecture=ecs.CpuArchitecture.X86_64
),
cpu=1024,
memory_limit_mi_b=2048
)
task_definition.add_container("windowsservercore",
logging=ecs.LogDriver.aws_logs(stream_prefix="win-iis-on-fargate"),
port_mappings=[ecs.PortMapping(container_port=80)],
image=ecs.ContainerImage.from_registry("mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019")
)
// Create a Task Definition for the Windows container to start
FargateTaskDefinition taskDefinition = FargateTaskDefinition.Builder.create(this, "TaskDef")
.runtimePlatform(RuntimePlatform.builder()
.operatingSystemFamily(OperatingSystemFamily.WINDOWS_SERVER_2019_CORE)
.cpuArchitecture(CpuArchitecture.X86_64)
.build())
.cpu(1024)
.memoryLimitMiB(2048)
.build();
taskDefinition.addContainer("windowsservercore", ContainerDefinitionOptions.builder()
.logging(LogDriver.awsLogs(AwsLogDriverProps.builder().streamPrefix("win-iis-on-fargate").build()))
.portMappings(List.of(PortMapping.builder().containerPort(80).build()))
.image(ContainerImage.fromRegistry("mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019"))
.build());
// Install: dotnet add package Amazon.CDK.Lib
// Create a Task Definition for the Windows container to start
var 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")
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Create a Task Definition for the Windows container to start
taskDefinition := ecs.NewFargateTaskDefinition(this, jsii.String("TaskDef"), &FargateTaskDefinitionProps{
RuntimePlatform: &RuntimePlatform{
OperatingSystemFamily: ecs.OperatingSystemFamily_WINDOWS_SERVER_2019_CORE(),
CpuArchitecture: ecs.CpuArchitecture_X86_64(),
},
Cpu: jsii.Number(1024),
MemoryLimitMiB: jsii.Number(2048),
})
taskDefinition.AddContainer(jsii.String("windowsservercore"), &ContainerDefinitionOptions{
Logging: ecs.LogDriver_AwsLogs(&AwsLogDriverProps{
StreamPrefix: jsii.String("win-iis-on-fargate"),
}),
PortMappings: []PortMapping{
&PortMapping{
ContainerPort: jsii.Number(80),
},
},
Image: ecs.ContainerImage_FromRegistry(jsii.String("mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019")),
})
Properties
datetimeFormatoptionalstringdatetime_formatoptionalstrdatetimeFormatoptionalStringDatetimeFormatoptionalstringDatetimeFormatoptional*string #Default: No multiline matching.
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.
logGroupoptionalILogGroupReflog_groupoptionalILogGroupReflogGroupoptionalILogGroupRefLogGroupoptionalILogGroupRefLogGroupoptionalILogGroupRef #Default: A log group is automatically created.
logRetentionoptionalRetentionDayslog_retentionoptionalRetentionDayslogRetentionoptionalRetentionDaysLogRetentionoptionalRetentionDaysLogRetentionoptionalRetentionDays #Default: Logs never expire.
maxBufferSizeoptionalSizemax_buffer_sizeoptionalSizemaxBufferSizeoptionalSizeMaxBufferSizeoptionalSizeMaxBufferSizeoptionalSize #Default: 1 megabyte if driver mode is non-blocking, otherwise this property is not set
modeoptionalAwsLogDriverModemodeoptionalAwsLogDriverModemodeoptionalAwsLogDriverModeModeoptionalAwsLogDriverModeModeoptionalAwsLogDriverMode = AwsLogDriverMode.BLOCKING #multilinePatternoptionalstringmultiline_patternoptionalstrmultilinePatternoptionalStringMultilinePatternoptionalstringMultilinePatternoptional*string #Default: No multiline matching.
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.
streamPrefixstringstream_prefixstrstreamPrefixStringStreamPrefixstringStreamPrefix*string required #notes
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