Skip to content

Logging

Logging for your tasks will be automatically setup based upon your specified configuration.

If you do not specify any logging configuration, then CloudWatch logs will be used.

Example Usage

logging:
  awslogs:
    retention: 180
logging:
  firelens:
    type: "fluentbit"
    options:
      enable-ecs-log-metadata: true
      Name: thing
      region: "us-east-1"
      delivery_stream: "my-stream"
      log-driver-buffer-limit: "2097152"
logging:
  custom:
    driver: "splunk"
    options:
      splunk-url: http://spunkysplunky.splunkcloud.com:8080/
      splunk-insecureskipverify: "True"
      splunk-token:
        ssm: /secrets/splunktoken

Fields

You should select only one of the following:

awslogs

See Using CloudWatch Logs

This is the default if you do not specify a logging block

firelens

See Using FireLens

custom

See Using Custom Logging

disabled

Disable all logging

Default: false

Note: If you specify multiple options, then the following order will be used: Custom, Firelens, Awslogs.


Using CloudWatch Logs

Note: When using CloudWatch logs, the deployer will automatically create any missing log groups for you.

Fields

retention

How many days logs should be kept.

To keep logs forever, specify forever

Valid values can be found on the PutRetentionPolicy documentation.

Default: 180 (days)

options

Allows you to specify extra options for the awslogs driver.

Note: awslogs-group, awslogs-stream-prefix and awslogs-region are already set for you.

Valid options: awslogs driver options

disabled

Disable CloudWatch logs.

Default: false

See Also


Using FireLens

Note: When using firelens, a container dependency will be automatically created for you. Your primary container will depend on the firelens router.

Fields

type

The FireLens log router flavor you want to use.
Possible Options:

  • fluentbit - (preferred, default)
  • fluentd

Default: fluentbit

options

Allows you to specify options to provide for the individual task container log configurations.

Options can be specified identically to how Environment Variables are specified. Values that reference an SSM Parameter will be added to the SecretOptions field on the container. All others will be added to Options.

Unless you are using a custom log router image that has these values already set for you, this field is most likely required.

Usage example

logging:
  firelens:
    type: fluentbit
    options:
      Name: thing
      region: "us-east-1"
      delivery_stream: "my-stream"
      log-driver-buffer-limit: "2097152"
      whatever: {template: "{{ .Date }}"}
router_options

Allows you to specify options that will be passed to the Firelens router container only. These are not applied to the task containers.

Options can be specified identically to how Environment Variables are specified, but you cannot specify any SSM parameters.

You generally will not need to configure this. This is meant for advanced customization of Firelens.

Usage example

logging:
  firelens:
    type: fluentbit
    options:
      Name: thing
      region: "us-east-1"
      delivery_stream: "my-stream"
    router_options:
      enable-ecs-log-metadata: true
memory

Memory reservation for this container.

This will be used as the reservation setting for the container within this task. This should generally be low, as this will prevent the logging container from stealing memory from the primary container

Default: 50 (megabytes)

Advanced Fields

image

Override the FireLens router image to use.

If you are using fluentbit, then this will default to the official fluentbit image

If you are using fluentd then you must specify this.

See Specifying Images for more information.

inherit_env

Should the logging container inherit all the environment variables that were provided to the primary container?

Note: if you have many environment variables, you might encounter task size limits.

Default: false

environment

Add extra environment variables that are specific to this container (and will not be shared to the other containers in the task.)

For more info, read the Environment Variables documentation.

container_name

The name of the logging container. Normally you should not be changing this.

Default: log_router

log_to_awslogs

Whether the firelens container itself should log to CloudWatch logs or not. This is helpful if you are debugging issues with your log router, but otherwise is not necessary.

This is either:

  • Boolean false - disable logging to Cloudwatch Logs (default)
  • String (the log group you want to log to) - You are responsible for making this group. (Or allow the execution_role to create it)

Default: false

credentials

Optional private registry credentials

disabled

Disable FireLens entirely.

Default: false


Using Custom Logging

Fields

driver

The log driver you want to use. (ex: splunk)

Default: blank (disabled)

options

Allows you to specify extra options for the driver. Options are specific to the driver you selected.