From 1a0b5b9298af3372b0f1bd52eb868454c5118551 Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Wed, 25 Oct 2023 11:05:53 +0100 Subject: [PATCH 1/4] Use aws-for-fluent-bit `init` image and add ECS Metadata --- ecs/Dockerfile | 14 +++++++++++--- ecs/{parsers.conf => guardian-parsers.conf} | 0 ecs/{custom.conf => guardian.conf} | 3 --- 3 files changed, 11 insertions(+), 6 deletions(-) rename ecs/{parsers.conf => guardian-parsers.conf} (100%) rename ecs/{custom.conf => guardian.conf} (87%) diff --git a/ecs/Dockerfile b/ecs/Dockerfile index ba2f106..f91eb13 100644 --- a/ecs/Dockerfile +++ b/ecs/Dockerfile @@ -1,3 +1,11 @@ -FROM amazon/aws-for-fluent-bit:latest -ADD parsers.conf /parsers.conf -ADD custom.conf /custom.conf +FROM amazon/aws-for-fluent-bit:init-2.32.0 + +ENV aws_fluent_bit_init_file_1 /guardian.conf +ENV aws_fluent_bit_init_file_2 /guardian-parsers.conf + +# Added by aws-for-fluent-bit base image +# https://github.com/aws/aws-for-fluent-bit/blob/develop/scripts/dockerfiles/Dockerfile.main-release#L49 +ENV aws_fluent_bit_init_file_3 /ecs/ecs-metadata.conf + +ADD guardian-parsers.conf /guardian-parsers.conf +ADD guardian.conf /guardian.conf diff --git a/ecs/parsers.conf b/ecs/guardian-parsers.conf similarity index 100% rename from ecs/parsers.conf rename to ecs/guardian-parsers.conf diff --git a/ecs/custom.conf b/ecs/guardian.conf similarity index 87% rename from ecs/custom.conf rename to ecs/guardian.conf index 7542a49..a3e5231 100644 --- a/ecs/custom.conf +++ b/ecs/guardian.conf @@ -1,6 +1,3 @@ -[SERVICE] - Parsers_File /parsers.conf - [FILTER] Name modify Match * From 1638e91b29083a1443f31ee6bdd0b066f9d89e4c Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Wed, 25 Oct 2023 11:36:16 +0100 Subject: [PATCH 2/4] Add documentation about what the aws_fluent_bit_init environment variables are doing --- ecs/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ecs/Dockerfile b/ecs/Dockerfile index f91eb13..fbcbf9f 100644 --- a/ecs/Dockerfile +++ b/ecs/Dockerfile @@ -1,5 +1,7 @@ FROM amazon/aws-for-fluent-bit:init-2.32.0 +# Environment variables are used to specify which config files to load +# https://github.com/aws/aws-for-fluent-bit/blob/mainline/use_cases/init-process-for-fluent-bit/README.md#how-to-use-multi-config-feature ENV aws_fluent_bit_init_file_1 /guardian.conf ENV aws_fluent_bit_init_file_2 /guardian-parsers.conf From 1b7a7c1ad142c3f2093c5583a4093e36c040a835 Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Thu, 26 Oct 2023 18:27:16 +0100 Subject: [PATCH 3/4] Change order of fluent bit init files --- ecs/Dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ecs/Dockerfile b/ecs/Dockerfile index fbcbf9f..7db4c28 100644 --- a/ecs/Dockerfile +++ b/ecs/Dockerfile @@ -1,13 +1,15 @@ FROM amazon/aws-for-fluent-bit:init-2.32.0 +# Added by aws-for-fluent-bit base image +# https://github.com/aws/aws-for-fluent-bit/blob/develop/scripts/dockerfiles/Dockerfile.main-release#L49 +ENV aws_fluent_bit_init_file_1 /ecs/ecs-metadata.conf + # Environment variables are used to specify which config files to load # https://github.com/aws/aws-for-fluent-bit/blob/mainline/use_cases/init-process-for-fluent-bit/README.md#how-to-use-multi-config-feature -ENV aws_fluent_bit_init_file_1 /guardian.conf -ENV aws_fluent_bit_init_file_2 /guardian-parsers.conf +ENV aws_fluent_bit_init_file_2 /guardian.conf +ENV aws_fluent_bit_init_file_3 /guardian-parsers.conf + -# Added by aws-for-fluent-bit base image -# https://github.com/aws/aws-for-fluent-bit/blob/develop/scripts/dockerfiles/Dockerfile.main-release#L49 -ENV aws_fluent_bit_init_file_3 /ecs/ecs-metadata.conf ADD guardian-parsers.conf /guardian-parsers.conf ADD guardian.conf /guardian.conf From 2b8501c1231eadac9adfc34e362f5eafdfd5719f Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Thu, 26 Oct 2023 18:42:31 +0100 Subject: [PATCH 4/4] Hopefully final order of config files to be loaded --- ecs/Dockerfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ecs/Dockerfile b/ecs/Dockerfile index 7db4c28..714d7fb 100644 --- a/ecs/Dockerfile +++ b/ecs/Dockerfile @@ -1,15 +1,16 @@ FROM amazon/aws-for-fluent-bit:init-2.32.0 -# Added by aws-for-fluent-bit base image -# https://github.com/aws/aws-for-fluent-bit/blob/develop/scripts/dockerfiles/Dockerfile.main-release#L49 -ENV aws_fluent_bit_init_file_1 /ecs/ecs-metadata.conf - # Environment variables are used to specify which config files to load # https://github.com/aws/aws-for-fluent-bit/blob/mainline/use_cases/init-process-for-fluent-bit/README.md#how-to-use-multi-config-feature -ENV aws_fluent_bit_init_file_2 /guardian.conf -ENV aws_fluent_bit_init_file_3 /guardian-parsers.conf +ENV aws_fluent_bit_init_file_1 /guardian-parsers.conf + +# Added by aws-for-fluent-bit base image +# https://github.com/aws/aws-for-fluent-bit/blob/develop/scripts/dockerfiles/Dockerfile.main-release#L49 +ENV aws_fluent_bit_init_file_2 /ecs/ecs-metadata.conf +# This config file must go last as it applies a `parser` filter which will interfere with any filters that are run before it (config files loaded in reverse order) +ENV aws_fluent_bit_init_file_3 /guardian.conf ADD guardian-parsers.conf /guardian-parsers.conf ADD guardian.conf /guardian.conf