From 9e7a6e2fc836ec033b6e8a8da388ea9c8d8b9031 Mon Sep 17 00:00:00 2001 From: Fabrizio Cafolla Date: Thu, 26 Sep 2024 10:33:04 +0200 Subject: [PATCH] fix: fluentbit logs (#7) --- README.md | 2 +- files/values.yml.tftpl | 26 +++++++++++++++----------- variables.tf | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index f3d0e46..951d8b4 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ It also opinionatedly configures FluentBit to send logs to CloudWatch and to exc | [fluentbit\_read\_from\_tail](#input\_fluentbit\_read\_from\_tail) | Start reading new entries. Skip entries already stored. | `string` | `"On"` | no | | [fluentbit\_send\_fluentbit\_logs\_to\_cloudwatch](#input\_fluentbit\_send\_fluentbit\_logs\_to\_cloudwatch) | Send FluentBit logs to CloudWatch. | `bool` | `true` | no | | [helm\_additional\_values](#input\_helm\_additional\_values) | Additional values to be passed to the Helm chart. | `list(string)` | `[]` | no | -| [helm\_chart\_version](#input\_helm\_chart\_version) | The version of the aws-for-fluent-bit Helm chart. | `string` | `"0.1.32"` | no | +| [helm\_chart\_version](#input\_helm\_chart\_version) | The version of the aws-for-fluent-bit Helm chart. | `string` | `"0.1.34"` | no | | [helm\_release\_name](#input\_helm\_release\_name) | The name of the Helm release. | `string` | `"fluentbit"` | no | | [k8s\_additional\_labels](#input\_k8s\_additional\_labels) | Additional labels to apply to the kubernetes resources. | `map(string)` | `{}` | no | | [k8s\_default\_labels](#input\_k8s\_default\_labels) | Labels to apply to the kubernetes resources. These are opinionated labels, you can add more labels using the variable `additional_k8s_labels`. If you want to remove a label, you can override it with an empty map(string). | `map(string)` |
{
"managed-by": "terraform",
"scope": "fluentbit"
}
| no | diff --git a/files/values.yml.tftpl b/files/values.yml.tftpl index ea04a16..d84304c 100644 --- a/files/values.yml.tftpl +++ b/files/values.yml.tftpl @@ -75,14 +75,14 @@ additionalInputs: | [INPUT] Name tail - Tag application-errors.* + Tag apperrors.* Exclude_Path ${join(", ", formatlist("/var/log/containers/%s*.log", distinct(additional_exclude_from_application_log_group)))} Path /var/log/containers/*.log Docker_Mode On Docker_Mode_Flush 5 Docker_Mode_Parser custom_json Parser custom_json - DB /var/fluent-bit/state/flb_container.db + DB /var/fluent-bit/state/flb_apperrors.db Mem_Buf_Limit 50MB Skip_Long_Lines On Refresh_Interval 10 @@ -135,7 +135,7 @@ filter: enabled: false additionalFilters: | - %{~ for tag in ["application", "application-errors", "platform", "fluentbit"] ~} + %{~ for tag in ["application", "apperrors", "platform", "fluentbit"] ~} [FILTER] Name kubernetes Match_regex ${tag}.* @@ -151,31 +151,35 @@ additionalFilters: | [FILTER] Name nest - Match_regex application.*|application-errors.*|platform.*|fluentbit.* + Match_regex application.*|apperrors.*|platform.*|fluentbit.* Operation lift Nested_under kubernetes Add_prefix Kube. [FILTER] Name modify - Match_regex application.*|application-errors.*|platform.*|fluentbit.* + Match_regex application.*|apperrors.*|platform.*|fluentbit.* Remove Kube. Remove Kube. Remove Kube. [FILTER] Name nest - Match_regex application.*|application-errors.*|platform.*|fluentbit.* + Match_regex application.*|apperrors.*|platform.*|fluentbit.* Operation nest Wildcard Kube.* Nested_under kubernetes Remove_prefix Kube. - # Retrive logs with status code 4xx and 5xx + [FILTER] + Name type_converter + Match apperrors.* + uint_key $log_processed['status'] response_status string + [FILTER] Name grep - Match application-errors.* - Regex $log_processed['status'] [45][0-9]{2} + Match apperrors.* + Regex response_status [45][0-9]{2} %{~ if additional_filters != "" } ${additional_filters} @@ -195,9 +199,9 @@ additionalOutputs: | [OUTPUT] Name cloudwatch_logs - Match application-errors.* + Match apperrors.* region $${AWS_REGION} - log_group_name /aws/containerinsights/$${CLUSTER_NAME}/application-errors + log_group_name /aws/containerinsights/$${CLUSTER_NAME}/apperrors log_stream_prefix $${HOST_NAME}- log_format json auto_create_group true diff --git a/variables.tf b/variables.tf index 54a4219..f5e56cb 100644 --- a/variables.tf +++ b/variables.tf @@ -13,7 +13,7 @@ variable "helm_release_name" { variable "helm_chart_version" { description = "The version of the aws-for-fluent-bit Helm chart." type = string - default = "0.1.32" + default = "0.1.34" } variable "helm_additional_values" {