# FirelensLogRouterDefinitionOptions

The options for creating a firelens log router.

Extends: FirelensLogRouterDefinitionOptions
Extends: ContainerDefinitionOptions

- Source: [`aws-ecs/lib/firelens-log-router.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-ecs/lib/firelens-log-router.ts#L109)

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_ecs as ecs } from 'aws-cdk-lib';

declare const appProtocol: ecs.AppProtocol;
declare const containerImage: ecs.ContainerImage;
declare const credentialSpec: ecs.CredentialSpec;
declare const environmentFile: ecs.EnvironmentFile;
declare const linuxParameters: ecs.LinuxParameters;
declare const logDriver: ecs.LogDriver;
declare const secret: ecs.Secret;
const firelensLogRouterDefinitionOptions: ecs.FirelensLogRouterDefinitionOptions = {
  firelensConfig: {
    type: ecs.FirelensLogRouterType.FLUENTBIT,

    // the properties below are optional
    options: {
      configFileType: ecs.FirelensConfigFileType.S3,
      configFileValue: 'configFileValue',
      enableECSLogMetadata: false,
    },
  },
  image: containerImage,

  // the properties below are optional
  command: ['command'],
  containerName: 'containerName',
  cpu: 123,
  credentialSpecs: [credentialSpec],
  disableNetworking: false,
  dnsSearchDomains: ['dnsSearchDomains'],
  dnsServers: ['dnsServers'],
  dockerLabels: {
    dockerLabelsKey: 'dockerLabels',
  },
  dockerSecurityOptions: ['dockerSecurityOptions'],
  enableRestartPolicy: false,
  entryPoint: ['entryPoint'],
  environment: {
    environmentKey: 'environment',
  },
  environmentFiles: [environmentFile],
  essential: false,
  extraHosts: {
    extraHostsKey: 'extraHosts',
  },
  gpuCount: 123,
  healthCheck: {
    command: ['command'],

    // the properties below are optional
    interval: cdk.Duration.minutes(30),
    retries: 123,
    startPeriod: cdk.Duration.minutes(30),
    timeout: cdk.Duration.minutes(30),
  },
  hostname: 'hostname',
  inferenceAcceleratorResources: ['inferenceAcceleratorResources'],
  interactive: false,
  linuxParameters: linuxParameters,
  logging: logDriver,
  memoryLimitMiB: 123,
  memoryReservationMiB: 123,
  portMappings: [{
    containerPort: 123,

    // the properties below are optional
    appProtocol: appProtocol,
    containerPortRange: 'containerPortRange',
    hostPort: 123,
    name: 'name',
    protocol: ecs.Protocol.TCP,
  }],
  privileged: false,
  pseudoTerminal: false,
  readonlyRootFilesystem: false,
  restartAttemptPeriod: cdk.Duration.minutes(30),
  restartIgnoredExitCodes: [123],
  secrets: {
    secretsKey: secret,
  },
  startTimeout: cdk.Duration.minutes(30),
  stopTimeout: cdk.Duration.minutes(30),
  systemControls: [{
    namespace: 'namespace',
    value: 'value',
  }],
  ulimits: [{
    hardLimit: 123,
    name: ecs.UlimitName.CORE,
    softLimit: 123,
  }],
  user: 'user',
  versionConsistency: ecs.VersionConsistency.ENABLED,
  workingDirectory: 'workingDirectory',
};
```

## Properties

- `command`: string[] = CMD value built into container image. — The command that is passed to the container.

  If you provide a shell command as a single string, you have to quote command-line arguments.

  **Default:** CMD value built into container image.

- `containerName`: string = id of node associated with ContainerDefinition. — The name of the container.

  **Default:** id of node associated with ContainerDefinition.

- `cpu`: number = No minimum CPU units reserved. — The minimum number of CPU units to reserve for the container.

- `credentialSpecs`: [CredentialSpec](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CredentialSpec.html)[] = No credential specs. — A list of ARNs in SSM or Amazon S3 to a credential spec (`CredSpec`) file that configures the container for Active Directory authentication.

  We recommend that you use this parameter instead of the `dockerSecurityOptions`.

  Currently, only one credential spec is allowed per container definition.

- `disableNetworking`: boolean = false — Specifies whether networking is disabled within the container.

  When this parameter is true, networking is disabled within the container.

- `dnsSearchDomains`: string[] = No search domains. — A list of DNS search domains that are presented to the container.

- `dnsServers`: string[] = Default DNS servers. — A list of DNS servers that are presented to the container.

- `dockerLabels`: { [key: string]: string } = No labels. — A key/value map of labels to add to the container.

- `dockerSecurityOptions`: string[] = No security labels. — A list of strings to provide custom labels for SELinux and AppArmor multi-level security systems.

- `enableRestartPolicy`: boolean = false unless `restartIgnoredExitCodes` or `restartAttemptPeriod` is set. — Enable a restart policy for a container.

  When you set up a restart policy, Amazon ECS can restart the container without needing to replace the task.

  **Default:** false unless `restartIgnoredExitCodes` or `restartAttemptPeriod` is set.

- `entryPoint`: string[] = Entry point configured in container. — The ENTRYPOINT value to pass to the container.

  **Default:** Entry point configured in container.

- `environment`: { [key: string]: string } = No environment variables. — The environment variables to pass to the container.

- `environmentFiles`: [EnvironmentFile](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.EnvironmentFile.html)[] = No environment files. — The environment files to pass to the container.

- `essential`: boolean = true — Specifies whether the container is marked essential.

  If the essential parameter of a container is marked as true, and that container fails
  or stops for any reason, all other containers that are part of the task are stopped.
  If the essential parameter of a container is marked as false, then its failure does not
  affect the rest of the containers in a task. All tasks must have at least one essential container.

  If this parameter is omitted, a container is assumed to be essential.

- `extraHosts`: { [key: string]: string } = No extra hosts. — A list of hostnames and IP address mappings to append to the /etc/hosts file on the container.

- `firelensConfig`: [FirelensConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.FirelensConfig.html) (required) — Firelens configuration.

- `gpuCount`: number = No GPUs assigned. — The number of GPUs assigned to the container.

- `healthCheck`: [HealthCheck](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.HealthCheck.html) = Health check configuration from container. — The health check command and associated configuration parameters for the container.

  **Default:** Health check configuration from container.

- `hostname`: string = Automatic hostname. — The hostname to use for your container.

- `image`: [ContainerImage](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.ContainerImage.html) (required) — The image used to start a container.

  This string is passed directly to the Docker daemon.
  Images in the Docker Hub registry are available by default.
  Other repositories are specified with either repository-url/image:tag or repository-url/image@digest.
  TODO: Update these to specify using classes of IContainerImage

- `inferenceAcceleratorResources`: string[] = No inference accelerators assigned. — The inference accelerators referenced by the container.

  **Default:** No inference accelerators assigned.

- `interactive`: boolean = false — When this parameter is true, you can deploy containerized applications that require stdin or a tty to be allocated.

- `linuxParameters`: [LinuxParameters](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.LinuxParameters.html) = No Linux parameters. — Linux-specific modifications that are applied to the container, such as Linux kernel capabilities.

  For more information see [KernelCapabilities](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_KernelCapabilities.html).

- `logging`: [LogDriver](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.LogDriver.html) = Containers use the same logging driver that the Docker daemon uses. — The log configuration specification for the container.

  **Default:** Containers use the same logging driver that the Docker daemon uses.

- `memoryLimitMiB`: number = No memory limit. — The amount (in MiB) of memory to present to the container.

  If your container attempts to exceed the allocated memory, the container
  is terminated.

  At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.

- `memoryReservationMiB`: number = No memory reserved. — The soft limit (in MiB) of memory to reserve for the container.

  When system memory is under heavy contention, Docker attempts to keep the
  container memory to this soft limit. However, your container can consume more
  memory when it needs to, up to either the hard limit specified with the memory
  parameter (if applicable), or all of the available memory on the container
  instance, whichever comes first.

  At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.

- `portMappings`: [PortMapping](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.PortMapping.html)[] = No ports are mapped. — The port mappings to add to the container definition.

- `privileged`: boolean = false — Specifies whether the container is marked as privileged.

  When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user).

- `pseudoTerminal`: boolean = false — When this parameter is true, a TTY is allocated.

  This parameter maps to Tty in the "Create a container section" of the
  Docker Remote API and the --tty option to `docker run`.

- `readonlyRootFilesystem`: boolean = false — When this parameter is true, the container is given read-only access to its root file system.

- `restartAttemptPeriod`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.seconds(300) if `enableRestartPolicy` is true, otherwise no period. — A period of time that the container must run for before a restart can be attempted.

  A container can be restarted only once every `restartAttemptPeriod` seconds.
  If a container isn't able to run for this time period and exits early, it will not be restarted.

  This property can't be used if `enableRestartPolicy` is set to false.

  You can set a minimum `restartAttemptPeriod` of 60 seconds and a maximum `restartAttemptPeriod`
  of 1800 seconds.

  **Default:** Duration.seconds(300) if `enableRestartPolicy` is true, otherwise no period.

- `restartIgnoredExitCodes`: number[] = No exit codes are ignored. — A list of exit codes that Amazon ECS will ignore and not attempt a restart on.

  This property can't be used if `enableRestartPolicy` is set to false.

  You can specify a maximum of 50 container exit codes.

- `secrets`: { [key: string]: [Secret](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.Secret.html) } = No secret environment variables. — The secret environment variables to pass to the container.

- `startTimeout`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = none — Time duration (in seconds) to wait before giving up on resolving dependencies for a container.

- `stopTimeout`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = none — Time duration (in seconds) to wait before the container is forcefully killed if it doesn't exit normally on its own.

- `systemControls`: [SystemControl](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.SystemControl.html)[] = No system controls are set. — A list of namespaced kernel parameters to set in the container.

- `ulimits`: [Ulimit](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.Ulimit.html)[] — An array of ulimits to set in the container.

- `user`: string = root — The user to use inside the container.

  This parameter maps to User in the Create a container section of the Docker Remote API and the --user option to docker run.

- `versionConsistency`: [VersionConsistency](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.VersionConsistency.html) = VersionConsistency.DISABLED if `image` is a CDK asset, VersionConsistency.ENABLED otherwise — Specifies whether Amazon ECS will resolve the container image tag provided in the container definition to an image digest.

  If you set the value for a container as disabled, Amazon ECS will
  not resolve the provided container image tag to a digest and will use the
  original image URI specified in the container definition for deployment.

  **Default:** VersionConsistency.DISABLED if `image` is a CDK asset, VersionConsistency.ENABLED otherwise

- `workingDirectory`: string = / — The working directory in which to run commands inside the container.
