From 5badd8e1ad63ea2081d44f0fff90a9fa6973b6b8 Mon Sep 17 00:00:00 2001 From: Aapo Talvensaari Date: Thu, 13 Feb 2025 18:21:23 +0000 Subject: [PATCH] chore(logging): reduce excessive log flooding on debug logs (follow up) I merged the PR https://github.com/Kong/kong-ee/pull/10652 prematurely. This adds a couple of log messages back for testing. Signed-off-by: Aapo Talvensaari --- bin/busted | 2 +- kong/clustering/control_plane.lua | 8 ++++---- kong/clustering/data_plane.lua | 5 +---- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/bin/busted b/bin/busted index 5be3493b056..e5e64e59f14 100755 --- a/bin/busted +++ b/bin/busted @@ -3,7 +3,6 @@ setmetatable(_G, nil) local pl_path = require("pl.path") - local pl_file = require("pl.file") local tools_system = require("kong.tools.system") @@ -47,6 +46,7 @@ if not os.getenv("KONG_BUSTED_RESPAWNED") then end -- add cli recursion detection table.insert(script, "export KONG_BUSTED_RESPAWNED=1") + table.insert(script, "export KONG_IS_TESTING=1") -- rebuild the invoked commandline, while inserting extra resty-flags local resty_flags = DEFAULT_RESTY_FLAGS diff --git a/kong/clustering/control_plane.lua b/kong/clustering/control_plane.lua index ecc41c63efd..035f54d1ffb 100644 --- a/kong/clustering/control_plane.lua +++ b/kong/clustering/control_plane.lua @@ -127,7 +127,7 @@ function _M:export_deflated_reconfigure_payload() -- store serialized plugins map for troubleshooting purposes local shm_key_name = "clustering:cp_plugins_configured:worker_" .. (worker_id() or -1) kong_dict:set(shm_key_name, json_encode(self.plugins_configured)) - kong.log.trace("plugin configuration map key: ", shm_key_name, " configuration: ", kong_dict:get(shm_key_name)) + kong.log.trace(_log_prefix, "plugin configuration map key: ", shm_key_name, " configuration: ", kong_dict:get(shm_key_name)) local config_hash, hashes = calculate_config_hash(config_table) @@ -374,7 +374,7 @@ function _M:handle_cp_websocket(cert) return nil, "invalid websocket frame received from data plane: " .. typ end - --ngx_log(ngx_DEBUG, _log_prefix, "received ping frame from data plane", log_suffix) + kong.log.trace(_log_prefix, "received ping frame from data plane", log_suffix) config_hash = data last_seen = ngx_time() @@ -419,8 +419,8 @@ function _M:handle_cp_websocket(cert) ngx_log(ngx_NOTICE, _log_prefix, "failed to send pong frame to data plane: ", err, log_suffix) - --else - -- ngx_log(ngx_DEBUG, _log_prefix, "sent pong frame to data plane", log_suffix) + else + kong.log.trace(_log_prefix, "sent pong frame to data plane", log_suffix) end -- pong ok diff --git a/kong/clustering/data_plane.lua b/kong/clustering/data_plane.lua index 2a44ef9cd44..8dfdfbc1907 100644 --- a/kong/clustering/data_plane.lua +++ b/kong/clustering/data_plane.lua @@ -394,10 +394,7 @@ function _M:communicate(premature) end if typ == "pong" then - kong.log.trace(ngx_DEBUG, _log_prefix, - "received pong frame from control plane", - log_suffix) - + kong.log.trace(_log_prefix, "received pong frame from control plane", log_suffix) goto continue end