Skip to content

Latest commit

 

History

History
116 lines (88 loc) · 3.14 KB

File metadata and controls

116 lines (88 loc) · 3.14 KB

Enable HTTP API healthcheck and set grace period

.. literalinclude:: docker-compose.yaml

This example is going even further than the previous one, where in our ECS Task definition, we have more than one container running, and we want both to be logging into firehose, but one of them, the NGINX one, is also going to want to use filters.

So to summarize, compose-x will

  • Lookup the KMS key to use for encryption
  • Create a new S3 bucket
  • Create a new Delivery Stream with the KMS key and deliver to the new bucket

For the web family, it will * Generate configuration for FireLens to include that will indicate to deliver logs

  • To FireHose, via the Advanced.ComposeXManagedAwsDestinations options.
  • To CloudWatch, generating the log group settings on its own

For the web2 family, it will simply setup the FireLens logging from the container to only go to FireHose.

Configuration generated by FireLens for web family

[INPUT]
    Name forward
    unix_path /var/run/fluent.sock

[INPUT]
    Name forward
    Listen 0.0.0.0
    Port 24224

[INPUT]
    Name tcp
    Tag firelens-healthcheck
    Listen 127.0.0.1
    Port 8877

[FILTER]
    Name record_modifier
    Match *
    Record ecs_cluster ANewCluster
    Record ecs_task_arn arn:aws:ecs:eu-west-1:374709687836:task/ANewCluster/c810b9e024e54a31852ca448f3929d9c
    Record ecs_task_definition web:38

@INCLUDE /compose_x_rendered/firelens.conf

[OUTPUT]
    Name null
    Match firelens-healthcheck

[OUTPUT]
    Name cloudwatch
    Match random-logs-firelens*
    auto_create_group true
    log_group_name a-custom-name
    log_stream_prefix random-logs
    region eu-west-1

[OUTPUT]
    Name cloudwatch
    Match web-firelens*
    auto_create_group true
    log_group_name complex-firelens/svc/ecs/web/ANewCluster

Configuration generated by compose-x for web family. Note that when genrating the configuration, Compose-X automatically added environment variables for the fluentbit container to use, in order to retrieve the right value.

[SERVICE]
    HTTP_Server  On
    HTTP_Listen  0.0.0.0
    HTTP_PORT    2020
    Health_Check On
    # customize error and retry thresholds and evaluation period as desired
    HC_Errors_Count 5
    HC_Retry_Failure_Count 5
    HC_Period 5


[SERVICE]
    Flush 1
    Grace 60

[SERVICE]
    Parsers_File /fluent-bit/parsers/parsers.conf

[FILTER]
    Name modify
    Match web-firelens*
    Rename ecs_task_arn task_id

[FILTER]
    Name parser
    Match web-firelens*
    Parser nginx
    Key_Name log
    Reserve_Data True

[OUTPUT]
    Name kinesis_firehose
    Match web-firelens*
    region ${STREAM_TO_S3_DIRECT_PUT_AWS_REGION}
    delivery_stream ${STREAM_TO_S3_DIRECT_PUT}