# GenericLogDriverProps

The configuration to use when creating a log driver.

Used as props by: [GenericLogDriver](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.GenericLogDriver.html)

- Source: [`aws-ecs/lib/log-drivers/generic-log-driver.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/generic-log-driver.ts#L10)

## Example

TypeScript:

```ts
// Create a Task Definition for the container to start
const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef');
taskDefinition.addContainer('TheContainer', {
  image: ecs.ContainerImage.fromRegistry('example-image'),
  memoryLimitMiB: 256,
  logging: new ecs.GenericLogDriver({
    logDriver: 'fluentd',
    options: {
      tag: 'example-tag',
    },
  }),
});
```

Python:

```python
# Create a Task Definition for the container to start
task_definition = ecs.Ec2TaskDefinition(self, "TaskDef")
task_definition.add_container("TheContainer",
    image=ecs.ContainerImage.from_registry("example-image"),
    memory_limit_mi_b=256,
    logging=ecs.GenericLogDriver(
        log_driver="fluentd",
        options={
            "tag": "example-tag"
        }
    )
)
```

Java:

```java
// Create a Task Definition for the container to start
Ec2TaskDefinition taskDefinition = new Ec2TaskDefinition(this, "TaskDef");
taskDefinition.addContainer("TheContainer", ContainerDefinitionOptions.builder()
        .image(ContainerImage.fromRegistry("example-image"))
        .memoryLimitMiB(256)
        .logging(GenericLogDriver.Builder.create()
                .logDriver("fluentd")
                .options(Map.of(
                        "tag", "example-tag"))
                .build())
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// Create a Task Definition for the container to start
var taskDefinition = new Ec2TaskDefinition(this, "TaskDef");
taskDefinition.AddContainer("TheContainer", new ContainerDefinitionOptions {
    Image = ContainerImage.FromRegistry("example-image"),
    MemoryLimitMiB = 256,
    Logging = new GenericLogDriver(new GenericLogDriverProps {
        LogDriver = "fluentd",
        Options = new Dictionary<string, string> {
            { "tag", "example-tag" }
        }
    })
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Create a Task Definition for the container to start
taskDefinition := ecs.NewEc2TaskDefinition(this, jsii.String("TaskDef"))
taskDefinition.AddContainer(jsii.String("TheContainer"), &ContainerDefinitionOptions{
	Image: ecs.ContainerImage_FromRegistry(jsii.String("example-image")),
	MemoryLimitMiB: jsii.Number(256),
	Logging: ecs.NewGenericLogDriver(&GenericLogDriverProps{
		LogDriver: jsii.String("fluentd"),
		Options: map[string]*string{
			"tag": jsii.String("example-tag"),
		},
	}),
})
```

## Properties

- `logDriver`: string (required) — The log driver to use for the container.

  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 and splunk.
  For tasks using the EC2 launch type, the supported log drivers are awslogs, syslog, gelf, fluentd, splunk, journald, and json-file.

  For more information about using the awslogs log driver, see
  [Using the awslogs Log Driver](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_awslogs.html)
  in the Amazon Elastic Container Service Developer Guide.

- `options`: { [key: string]: string } — The configuration options to send to the log driver.

  **Default:** the log driver options.

- `secretOptions`: { [key: string]: [Secret](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.Secret.html) } — The secrets to pass to the log configuration.

  **Default:** no secret options provided.
