services.x-logging

x-logging syntax definition
services:
  serviceA:
    x-logging:
      RetentionInDays: int

RetentionInDays

Value to indicate how long should the logs be retained for the service.

Hint

If the value you enter is not in the allowed values, will set to the closest accepted value.

Hint

Emulates the CW Logs property RetentionInDays Property

FireLens


FireLens is a configuration that will automatically generate the configuration for FluentBit to ship logs in the appropriate destinations configured.

We recommend the Rendered configuration which works for AWS Fargate, EC2 and ECS Anywhere.

Rendered

Hint

We recommend to use that option as it will work in all compute platforms.

s3FileConfiguration

Note

Only works when deploying to AWS ECS on EC2 instances.

Examples

services:
  serviceA:
    x-logging:
      RetentionInDays: 42

Hint

The following parameter is identical in behaviour to x-aws-logs_retention defined in the docker ECS Plugin.

Note

Alternatively you can use the ECS Plugin logging definition will ECS Compose-X will use. If both are defined, priority goes to the highest value.

JSON Schema

Model

services.x-logging specification

services.x-logging

The services.x-logging specification for ComposeX

type

object

properties

  • RetentionInDays

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#cfn-logs-loggroup-retentionindays

type

integer

  • FireLens

Define options to configure FireLens and FluentBit accordingly

type

object

properties

  • Shorthands

#/definitions/FireLensShorthands

  • Advanced

#/definitions/FireLensAdvancedConfig

additionalProperties

False

additionalProperties

False

definitions

  • FireLensShorthands

type

object

properties

  • ReplaceAwsLogs

If set to true, will use FireLens with CloudWatch logs instead of awslogs driver

type

boolean

default

False

  • FirelensConfiguration

#/definitions/FirelensConfiguration

additionalProperties

False

  • FirelensConfiguration

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-firelensconfiguration.html

type

object

properties

  • Type

Which fluent to use. FluentD only works when using FireLensService.

type

string

enum

fluentbit, fluentd

default

fluentbit

  • Options

type

object

properties

  • enable-ecs-log-metadata

type

boolean

default

True

  • config-file-type

type

string

enum

file, s3

  • config-file-value

type

string

additionalProperties

False

dependencies

  • config-file-type

additionalProperties

False

  • FireLensAdvancedConfig

type

object

properties

  • DockerImageOverride

Docker image to use instead of the AWS-fluentbit image

type

string

  • LogDriverBufferLimit

Amount in bytes, of RAM to assign to the FireLens container to cater for BufferLimit.

type

number

minimum

33554432

default

67108864

  • SidecarCpuReservation

Customizable CPU Limit for the sidecar container.

type

number

minimum

0.1

default

0.1

  • FirelensConfiguration

#/definitions/FirelensConfiguration

  • SourceFile

Path to the source file that contains the configuration

type

string

  • ParserFiles

List of files to use to add via the config sidecar

type

array

items

Path to the files to add as ParserFiles

type

string

minItems

1

  • EnableApiHeathCheck

Automatically adds API based healthcheck for fluentbit instead of nc based.

type

boolean

default

True

  • GracePeriod

Time in seconds for GRACE period before the container stops after receiving SIGTERM

type

number

maximum

120

minimum

5

default

30

  • ComposeXManagedAwsDestinations

Generates automatically a new OUTPUT for a Compose-X managed resource

type

array

items

oneOf

#/definitions/FireLensCloudWatchManagedDestination

#/definitions/FireLensFirehoseManagedDestination

#/definitions/FireLensKinesisManagedDestination

uniqueItems

True

  • EnvironmentVariables

#/definitions/RenderEnvVars

additionalProperties

False

  • FireLensFirehoseManagedDestination

Allows to setup all settings for OUTPUT https://docs.fluentbit.io/manual/pipeline/outputs/firehose

type

object

properties

  • delivery_stream

Define delivery_stream with simple name or a delivery stream defined in x-kinesis_firehose.

type

string

additionalProperties

True

  • FireLensKinesisManagedDestination

type

object

properties

  • stream

Define delivery_stream with simple name or a data stream defined in x-kinesis.

type

string

  • FireLensCloudWatchManagedDestination

Allows to define all settings for OUTPUT https://docs.fluentbit.io/manual/pipeline/outputs/cloudwatch

type

object

properties

  • log_group_name

Value for log_group_name from the original plugin.

type

string

  • RenderEnvVars

Allows to specify extra environment variables to the firelens container

type

object

patternProperties

  • ^[a-zA-Z\d._-]+$

oneOf

type

string

Allows to use CFN Ref or Sub functions directly

type

object

properties

  • Fn::Sub

type

string

  • Fn::Ref

type

string

additionalProperties

False

Definition

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "services.x-logging.spec.json",
  "id": "services.x-logging",
  "type": "object",
  "title": "services.x-logging specification",
  "description": "The services.x-logging specification for ComposeX",
  "additionalProperties": false,
  "properties": {
    "RetentionInDays": {
      "type": "integer",
      "description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#cfn-logs-loggroup-retentionindays"
    },
    "FireLens": {
      "type": "object",
      "additionalProperties": false,
      "description": "Define options to configure FireLens and FluentBit accordingly",
      "oneOf": [
        {
          "required": [
            "Shorthands"
          ]
        },
        {
          "required": [
            "Advanced"
          ]
        }
      ],
      "properties": {
        "Shorthands": {
          "$ref": "#/definitions/FireLensShorthands"
        },
        "Advanced": {
          "$ref": "#/definitions/FireLensAdvancedConfig"
        }
      }
    }
  },
  "definitions": {
    "FireLensShorthands": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "ReplaceAwsLogs": {
          "type": "boolean",
          "default": false,
          "description": "If set to true, will use FireLens with CloudWatch logs instead of awslogs driver"
        },
        "FirelensConfiguration": {
          "$ref": "#/definitions/FirelensConfiguration"
        }
      }
    },
    "FirelensConfiguration": {
      "type": "object",
      "description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-firelensconfiguration.html",
      "additionalProperties": false,
      "properties": {
        "Type": {
          "type": "string",
          "description": "Which fluent to use. FluentD only works when using FireLensService.",
          "default": "fluentbit",
          "enum": [
            "fluentbit",
            "fluentd"
          ]
        },
        "Options": {
          "type": "object",
          "additionalProperties": false,
          "dependencies": {
            "config-file-type": {
              "required": [
                "config-file-value"
              ]
            }
          },
          "properties": {
            "enable-ecs-log-metadata": {
              "type": "boolean",
              "default": true
            },
            "config-file-type": {
              "type": "string",
              "enum": [
                "file",
                "s3"
              ]
            },
            "config-file-value": {
              "type": "string"
            }
          }
        }
      }
    },
    "FireLensAdvancedConfig": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "DockerImageOverride": {
          "type": "string",
          "description": "Docker image to use instead of the AWS-fluentbit image"
        },
        "LogDriverBufferLimit": {
          "type": "number",
          "minimum": 33554432,
          "default": 67108864,
          "description": "Amount in bytes, of RAM to assign to the FireLens container to cater for BufferLimit."
        },
        "SidecarCpuReservation": {
          "type": "number",
          "minimum": 0.1,
          "description": "Customizable CPU Limit for the sidecar container.",
          "default": 0.1
        },
        "FirelensConfiguration": {
          "$ref": "#/definitions/FirelensConfiguration"
        },
        "SourceFile": {
          "type": "string",
          "description": "Path to the source file that contains the configuration"
        },
        "ParserFiles": {
          "type": "array",
          "minItems": 1,
          "description": "List of files to use to add via the config sidecar",
          "items": {
            "type": "string",
            "description": "Path to the files to add as ParserFiles"
          }
        },
        "EnableApiHeathCheck": {
          "type": "boolean",
          "default": true,
          "description": "Automatically adds API based healthcheck for fluentbit instead of nc based."
        },
        "GracePeriod": {
          "type": "number",
          "minimum": 5,
          "maximum": 120,
          "default": 30,
          "description": "Time in seconds for GRACE period before the container stops after receiving SIGTERM"
        },
        "ComposeXManagedAwsDestinations": {
          "type": "array",
          "uniqueItems": true,
          "description": "Generates automatically a new OUTPUT for a Compose-X managed resource",
          "items": {
            "oneOf": [
              {
                "$ref": "#/definitions/FireLensCloudWatchManagedDestination"
              },
              {
                "$ref": "#/definitions/FireLensFirehoseManagedDestination"
              },
              {
                "$ref": "#/definitions/FireLensKinesisManagedDestination"
              }
            ]
          }
        },
        "EnvironmentVariables": {
          "$ref": "#/definitions/RenderEnvVars"
        }
      }
    },
    "FireLensFirehoseManagedDestination": {
      "type": "object",
      "required": [
        "delivery_stream"
      ],
      "description": "Allows to setup all settings for OUTPUT https://docs.fluentbit.io/manual/pipeline/outputs/firehose",
      "additionalProperties": true,
      "properties": {
        "delivery_stream": {
          "type": "string",
          "description": "Define delivery_stream with simple name or a delivery stream defined in x-kinesis_firehose."
        }
      }
    },
    "FireLensKinesisManagedDestination": {
      "type": "object",
      "required": ["stream"],
      "properties": {
        "stream": {
          "type": "string",
          "description": "Define delivery_stream with simple name or a data stream defined in x-kinesis."
        }
      }
    },
    "FireLensCloudWatchManagedDestination": {
      "type": "object",
      "description": "Allows to define all settings for OUTPUT https://docs.fluentbit.io/manual/pipeline/outputs/cloudwatch",
      "required": [
        "log_group_name"
      ],
      "properties": {
        "log_group_name": {
          "type": "string",
          "description": "Value for log_group_name from the original plugin."
        }
      }
    },
    "RenderEnvVars": {
      "type": "object",
      "description": "Allows to specify extra environment variables to the firelens container",
      "patternProperties": {
        "^[a-zA-Z\\d._-]+$": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "object",
              "additionalProperties": false,
              "description": "Allows to use CFN Ref or Sub functions directly",
              "properties": {
                "Fn::Sub": {
                  "type": "string"
                },
                "Fn::Ref": {
                  "type": "string"
                }
              },
              "oneOf": [
                {
                  "required": [
                    "Fn::Ref"
                  ]
                },
                {
                  "required": [
                    "Fn::Sub"
                  ]
                }
              ]
            }
          ]
        }
      }
    }
  }
}