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 (#13714)

### 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 <aapo.talvensaari@gmail.com>
  • Loading branch information
bungle authored Sep 27, 2024
1 parent b64b6fb commit d1fc73b
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

1 comment on commit d1fc73b

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel Build

Docker image available kong/kong:d1fc73bf566955359728866870398406787f1721
Artifacts available https://github.com/Kong/kong/actions/runs/11071548580

Please sign in to comment.