FireLensLogDriver

class aws_cdk.aws_ecs.FireLensLogDriver(*, options=None, secret_options=None, env=None, env_regex=None, labels=None, tag=None)

Bases: LogDriver

FireLens enables you to use task definition parameters to route logs to an AWS service or AWS Partner Network (APN) destination for log storage and analytics.

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs

# secret: ecs.Secret

fire_lens_log_driver = ecs.FireLensLogDriver(
    env=["env"],
    env_regex="envRegex",
    labels=["labels"],
    options={
        "options_key": "options"
    },
    secret_options={
        "secret_options_key": secret
    },
    tag="tag"
)

Constructs a new instance of the FireLensLogDriver class.

Parameters:
  • options (Optional[Mapping[str, str]]) – The configuration options to send to the log driver. Default: - the log driver options

  • secret_options (Optional[Mapping[str, Secret]]) – The secrets to pass to the log configuration. Default: - No secret options provided.

  • env (Optional[Sequence[str]]) – The env option takes an array of keys. 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. Default: - No env

  • env_regex (Optional[str]) – The env-regex option is similar to and compatible with env. Its value is a regular expression to match logging-related environment variables. It is used for advanced log tag options. Default: - No envRegex

  • labels (Optional[Sequence[str]]) – The labels option takes an array of keys. 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. Default: - No labels

  • tag (Optional[str]) – By default, Docker uses the first 12 characters of the container ID to tag log messages. Refer to the log tag option documentation for customizing the log tag format. Default: - The first 12 characters of the container ID

Methods

bind(_scope, _container_definition)

Called when the log driver is configured on a container.

Parameters:
Return type:

LogDriverConfig

Static Methods

classmethod aws_logs(*, stream_prefix, datetime_format=None, log_group=None, log_retention=None, mode=None, multiline_pattern=None)

Creates a log driver configuration that sends log information to CloudWatch Logs.

Parameters:
  • stream_prefix (str) – Prefix for the log streams. The awslogs-stream-prefix option allows you to associate a log stream with the specified prefix, the container name, and the ID of the Amazon ECS task to which the container belongs. If you specify a prefix with this option, then the log stream takes the following format:: prefix-name/container-name/ecs-task-id

  • datetime_format (Optional[str]) – This option defines a multiline start pattern in Python strftime format. A log message consists of a line that matches the pattern and any following lines that don’t match the pattern. Thus the matched line is the delimiter between log messages. Default: - No multiline matching.

  • log_group (Optional[ILogGroup]) – The log group to log to. Default: - A log group is automatically created.

  • log_retention (Optional[RetentionDays]) – The number of days log events are kept in CloudWatch Logs when the log group is automatically created by this construct. Default: - Logs never expire.

  • mode (Optional[AwsLogDriverMode]) – The delivery mode of log messages from the container to awslogs. Default: - AwsLogDriverMode.BLOCKING

  • multiline_pattern (Optional[str]) – This option defines a multiline start pattern using a regular expression. A log message consists of a line that matches the pattern and any following lines that don’t match the pattern. Thus the matched line is the delimiter between log messages. This option is ignored if datetimeFormat is also configured. Default: - No multiline matching.

Return type:

LogDriver