Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(clustering): adjust control plane log level when client closes the connection #13714

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions 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 @@ -490,12 +495,22 @@ function _M:handle_cp_websocket(cert)
--update_sync_status()

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

return ngx_exit(ngx_ERROR)
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
Loading