From 6724eda42ddf1fe348d8e374a68af830d50ea65c Mon Sep 17 00:00:00 2001 From: Jaskaran Sarkaria Date: Fri, 22 Nov 2024 14:41:20 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20parse=20debug=20logs=20co?= =?UTF-8?q?rrectly=20(#109)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- configmap.tf | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/configmap.tf b/configmap.tf index 40ff2d9..6ed97fc 100644 --- a/configmap.tf +++ b/configmap.tf @@ -44,7 +44,6 @@ resource "kubernetes_config_map" "fluent-bit-config" { Alias modsec_nginx_ingress_debug Tag cp-ingress-modsec-debug.* Path /var/log/debug/**/**/* - Parser docker Refresh_Interval 5 Buffer_Max_Size 5MB Buffer_Chunk_Size 1M @@ -101,24 +100,16 @@ resource "kubernetes_config_map" "fluent-bit-config" { script /fluent-bit/scripts/cb_extract_tag_value.lua call cb_extract_tag_value - [FILTER] - Name parser - Parser generic-json - Match cp-ingress-modsec-audit.* - Key_Name log - Reserve_Data On - Preserve_Key On - [FILTER] Name lua Match cp-ingress-modsec-debug.* - script /fluent-bit/scripts/cb_extract_tag_value.lua - call cb_extract_tag_value + script /fluent-bit/scripts/cb__tag_all_value.lua + call cb_tag_all_value [FILTER] Name parser Parser generic-json - Match cp-ingress-modsec-debug.* + Match cp-ingress-modsec-audit.* Key_Name log Reserve_Data On Preserve_Key On @@ -191,6 +182,14 @@ resource "kubernetes_config_map" "fluent_bit_lua_script" { } } data = { + "cb_tag_all_value.lua" = <<-EOT + function cb_tag_all_value(tag, timestamp, record) + local new_record = record + + new_record["github_teams"] = "all-org-members" + return 1, timestamp, new_record + end + EOT "cb_extract_tag_value.lua" = <<-EOT function cb_extract_tag_value(tag, timestamp, record) local github_team = string.gmatch(record["log"], '%[tag "github_team=([%w+|%-]*)"%]')