Skip to content

Commit

Permalink
chore(clustering): adjust control plane log level when client closes …
Browse files Browse the repository at this point in the history
…the connection

### Summary

Currently controlplane logs at ERROR level when dataplane closes the connection.
This commit lowers the log level to `DEBUG` in this common case.

Signed-off-by: Aapo Talvensaari <[email protected]>
  • Loading branch information
bungle committed Sep 27, 2024
1 parent b64b6fb commit 38faeff
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion kong/clustering/control_plane.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ local function is_timeout(err)
end


local function is_closed(err)
return err and sub(err, -6) == "closed"
end


local function extract_dp_cert(cert)
local expiry_timestamp = cert:get_not_after()
-- values in cert_details must be strings
Expand Down Expand Up @@ -495,7 +500,12 @@ function _M:handle_cp_websocket(cert)
end

if perr then
ngx_log(ngx_ERR, _log_prefix, perr, log_suffix)
if is_closed(perr) then
ngx_log(ngx_DEBUG, _log_prefix, "data plane closed the connection", log_suffix)
else
ngx_log(ngx_ERR, _log_prefix, perr, log_suffix)
end

return ngx_exit(ngx_ERROR)
end

Expand Down

0 comments on commit 38faeff

Please sign in to comment.