From de955b7bc56d89cfa17e6c9e234b6d3dc8b43003 Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Fri, 6 Aug 2021 15:25:40 -0700 Subject: [PATCH] Merge pull request #10951 from hashicorp/b-cn-proxy consul/connect: avoid warn messages on connect proxy errors --- .changelog/10951.txt | 3 +++ client/allocrunner/consul_grpc_sock_hook.go | 15 +++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 .changelog/10951.txt diff --git a/.changelog/10951.txt b/.changelog/10951.txt new file mode 100644 index 00000000000..0ca2b440175 --- /dev/null +++ b/.changelog/10951.txt @@ -0,0 +1,3 @@ +```release-note:improvement +consul/connect: Reduced the noise of log messages emitted for connect native tasks +``` diff --git a/client/allocrunner/consul_grpc_sock_hook.go b/client/allocrunner/consul_grpc_sock_hook.go index 91014fedc0e..07fe6ef4787 100644 --- a/client/allocrunner/consul_grpc_sock_hook.go +++ b/client/allocrunner/consul_grpc_sock_hook.go @@ -313,10 +313,10 @@ func proxyConn(ctx context.Context, logger hclog.Logger, destAddr string, conn n defer cancel() n, err := io.Copy(dest, conn) if ctx.Err() == nil && err != nil { - logger.Warn("error proxying to Consul", "error", err, "dest", destAddr, - "src_local", conn.LocalAddr(), "src_remote", conn.RemoteAddr(), - "bytes", n, - ) + // expect disconnects when proxying http + logger.Trace("error message received proxying to Consul", + "msg", err, "dest", destAddr, "src_local", conn.LocalAddr(), + "src_remote", conn.RemoteAddr(), "bytes", n) return } logger.Trace("proxy to Consul complete", @@ -332,10 +332,9 @@ func proxyConn(ctx context.Context, logger hclog.Logger, destAddr string, conn n defer cancel() n, err := io.Copy(conn, dest) if ctx.Err() == nil && err != nil { - logger.Warn("error proxying from Consul", "error", err, "dest", destAddr, - "src_local", conn.LocalAddr(), "src_remote", conn.RemoteAddr(), - "bytes", n, - ) + logger.Trace("error message received proxying from Consul", + "msg", err, "dest", destAddr, "src_local", conn.LocalAddr(), + "src_remote", conn.RemoteAddr(), "bytes", n) return } logger.Trace("proxy from Consul complete",