Skip to content
v2.277.0

LogDriverConfig Struct ​

The configuration to use when creating a log driver.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs as ecs } from 'aws-cdk-lib';
const logDriverConfig: ecs.LogDriverConfig = {
  logDriver: 'logDriver',

  // the properties below are optional
  options: {
    optionsKey: 'options',
  },
  secretOptions: [{
    name: 'name',
    valueFrom: 'valueFrom',
  }],
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ecs as ecs

log_driver_config = ecs.LogDriverConfig(
    log_driver="logDriver",

    # the properties below are optional
    options={
        "options_key": "options"
    },
    secret_options=[ecs.CfnTaskDefinition.SecretProperty(
        name="name",
        value_from="valueFrom"
    )]
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ecs.*;

LogDriverConfig logDriverConfig = LogDriverConfig.builder()
        .logDriver("logDriver")

        // the properties below are optional
        .options(Map.of(
                "optionsKey", "options"))
        .secretOptions(List.of(SecretProperty.builder()
                .name("name")
                .valueFrom("valueFrom")
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ECS;

var logDriverConfig = new LogDriverConfig {
    LogDriver = "logDriver",

    // the properties below are optional
    Options = new Dictionary<string, string> {
        { "optionsKey", "options" }
    },
    SecretOptions = new [] { new SecretProperty {
        Name = "name",
        ValueFrom = "valueFrom"
    } }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

logDriverConfig := &LogDriverConfig{
	LogDriver: jsii.String("logDriver"),

	// the properties below are optional
	Options: map[string]*string{
		"optionsKey": jsii.String("options"),
	},
	SecretOptions: []SecretProperty{
		&SecretProperty{
			Name: jsii.String("name"),
			ValueFrom: jsii.String("valueFrom"),
		},
	},
}

Properties ​

logDriverstringlog_driverstrlogDriverStringLogDriverstringLogDriver*string required #
The log driver to use for the container.
notes

The valid values listed for this parameter are log drivers that the Amazon ECS container agent can communicate with by default.

For tasks using the Fargate launch type, the supported log drivers are awslogs, splunk, and awsfirelens. For tasks using the EC2 launch type, the supported log drivers are awslogs, fluentd, gelf, json-file, journald, logentries,syslog, splunk, and awsfirelens.

For more information about using the awslogs log driver, see Using the awslogs Log Driver in the Amazon Elastic Container Service Developer Guide.

For more information about using the awsfirelens log driver, see Custom Log Routing in the Amazon Elastic Container Service Developer Guide.

optionsoptional{ [key: string]: string }optionsoptionaltyping.Mapping[str, str]optionsoptionalMap<String, String>OptionsoptionalIDictionary<string, string>Optionsoptional*map[string]*string #
The configuration options to send to the log driver.
secretOptionsoptionalCfnTaskDefinition.SecretProperty[]secret_optionsoptionaltyping.List[SecretProperty]secretOptionsoptionalList<SecretProperty>SecretOptionsoptionalSecretProperty[]SecretOptionsoptional*[]SecretProperty #
The secrets to pass to the log configuration.

Default: No secret options provided.