From 1329c2a0f6b9f0196fe2aed939878ffb88121157 Mon Sep 17 00:00:00 2001 From: Aram Karapetyan Date: Thu, 12 Oct 2023 13:49:22 +0400 Subject: [PATCH] feat(DMVP-eks-update): Fix fluent-bit --- README.md | 1 - modules/fluent-bit/locals.tf | 2 +- modules/fluent-bit/values.yaml.tpl | 28 +++++++++++++++------------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 934c615..f74b81f 100644 --- a/README.md +++ b/README.md @@ -211,7 +211,6 @@ worker_groups = { | [eks-cluster](#module\_eks-cluster) | ./modules/eks | n/a | | [external-secrets](#module\_external-secrets) | ./modules/external-secrets | n/a | | [fluent-bit](#module\_fluent-bit) | ./modules/fluent-bit | n/a | -| [loki](#module\_loki) | ./modules/loki | n/a | | [metrics-server](#module\_metrics-server) | ./modules/metrics-server | n/a | | [node-problem-detector](#module\_node-problem-detector) | ./modules/node-problem-detector | n/a | | [olm](#module\_olm) | ./modules/olm | n/a | diff --git a/modules/fluent-bit/locals.tf b/modules/fluent-bit/locals.tf index a59618b..0dae146 100644 --- a/modules/fluent-bit/locals.tf +++ b/modules/fluent-bit/locals.tf @@ -14,7 +14,7 @@ locals { inputs = try(var.fluent_bit_config.inputs, "") outputs = try(var.fluent_bit_config.outputs, "") filters = try(var.fluent_bit_config.filters, "") - kube_namespaces = "^(${join("|", var.kube_namespaces)})" + kube_namespaces = var.kube_namespaces } values = var.values_yaml == "" ? templatefile("${path.module}/values.yaml.tpl", local.config_settings) : var.values_yaml diff --git a/modules/fluent-bit/values.yaml.tpl b/modules/fluent-bit/values.yaml.tpl index b97e7f0..bc23097 100644 --- a/modules/fluent-bit/values.yaml.tpl +++ b/modules/fluent-bit/values.yaml.tpl @@ -3,7 +3,7 @@ config: inputs: | [INPUT] Name tail - Tag * + Tag kube.* Path /var/log/containers/*.log Read_from_head true multiline.parser docker, cri @@ -23,7 +23,7 @@ config: filters: | [FILTER] Name kubernetes - Match * + Match kube.* Merge_Log On Keep_Log Off K8S-Logging.Parser On @@ -31,29 +31,31 @@ config: [FILTER] Name grep - Match * - Exclude $message ${log_filters} + Match kube.* + Exclude $log ${log_filters} [FILTER] Name grep - Match * - Exclude $message ${additional_log_filters} + Match kube.* + Exclude $log ${additional_log_filters} + +%{ for value in kube_namespaces } + [FILTER] + Name rewrite_tag + Match kube.* + Rule $kubernetes['namespace_name'] ^${value}$ system.$TAG false +%{ endfor ~} [FILTER] Name grep Match * Exclude $kubernetes['namespace_name'] ${drop_namespaces} - [FILTER] - Name rewrite_tag - Match kube.* - Rule $kubernetes['namespace_name'] ${kube_namespaces} kube.$TAG false - ${indent(4, filters)} outputs: | [OUTPUT] Name cloudwatch_logs - Match * + Match kube.* region ${region} log_group_name ${log_group_name} log_stream_prefix from-fluent-bit- @@ -71,7 +73,7 @@ config: [OUTPUT] Name cloudwatch_logs - Match kube.* + Match system.* region ${region} log_group_name ${system_log_group_name} log_stream_prefix from-fluent-bit-