# GelfLogDriverProps

Specifies the journald log driver configuration options.

[Source](https://docs.docker.com/config/containers/logging/gelf/)

Extends: [BaseLogDriverProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.BaseLogDriverProps.html)
Used as props by: [GelfLogDriver](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.GelfLogDriver.html)
Used as argument in: [LogDrivers.gelf](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.LogDrivers.html#gelf)

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

## 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: ecs.LogDrivers.gelf({ address: 'my-gelf-address' }),
});
```

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.LogDrivers.gelf(address="my-gelf-address")
)
```

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(LogDrivers.gelf(GelfLogDriverProps.builder().address("my-gelf-address").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 = LogDrivers.Gelf(new GelfLogDriverProps { Address = "my-gelf-address" })
});
```

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.LogDrivers_Gelf(&GelfLogDriverProps{
		Address: jsii.String("my-gelf-address"),
	}),
})
```

## Properties

- `address`: string (required) — The address of the GELF server.

  tcp and udp are the only supported URI
  specifier and you must specify the port.

- `compressionLevel`: number = 1 — UDP Only The level of compression when gzip or zlib is the gelf-compression-type.

  An integer in the range of -1 to 9 (BestCompression). Higher levels provide more
  compression at lower speed. Either -1 or 0 disables compression.

- `compressionType`: [GelfCompressionType](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.GelfCompressionType.html) = gzip — UDP Only The type of compression the GELF driver uses to compress each log message.

  Allowed values are gzip, zlib and none.

- `env`: string[] — The env option takes an array of keys.

  **Default:** No env

  If there is collision between
  label and env keys, the value of the env takes precedence. Adds additional fields
  to the extra attributes of a logging message.

- `envRegex`: string — The env-regex option is similar to and compatible with env.

  **Default:** No envRegex

  Its value is a regular
  expression to match logging-related environment variables. It is used for advanced
  log tag options.

- `labels`: string[] — The labels option takes an array of keys.

  **Default:** No labels

  If there is collision
  between label and env keys, the value of the env takes precedence. Adds additional
  fields to the extra attributes of a logging message.

- `tag`: string — By default, Docker uses the first 12 characters of the container ID to tag log messages.

  **Default:** The first 12 characters of the container ID

  Refer to the log tag option documentation for customizing the
  log tag format.

- `tcpMaxReconnect`: number = 3 — TCP Only The maximum number of reconnection attempts when the connection drop.

  A positive integer.

- `tcpReconnectDelay`: [Duration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = 1 — TCP Only The number of seconds to wait between reconnection attempts.

  A positive integer.
