From 5022532a73ee73e43173d0bd3cf510a80d8a3f64 Mon Sep 17 00:00:00 2001 From: Gleb Aronsky Date: Fri, 8 Oct 2021 12:59:26 -0400 Subject: [PATCH] Backport commit to Reduce clutter of log entries Backport containerd 1.5.0 commit 1f5b84f27cd675780bc7127f9aedbfe34cc7590b to reduce clutter of log entries during process execution Test Plan: Verify containerd.log logs fewer messages PASS: Verified that the containerd.log file omits previously noisy log messages such as "ExecSync for", "Exec process", and "Finish piping" which are now logged at the Debug verbosity threshold. Story: 2009272 Task: 43588 Signed-off-by: Gleb Aronsky Change-Id: I71d52b8306185917144b0bbf40dd371508f78064 --- kubernetes/containerd/centos/containerd.spec | 2 + ...er-of-log-entries-during-process-exe.patch | 122 ++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 kubernetes/containerd/centos/files/0002-CRI-Reduce-clutter-of-log-entries-during-process-exe.patch diff --git a/kubernetes/containerd/centos/containerd.spec b/kubernetes/containerd/centos/containerd.spec index 67f8cfe3b..906a93f27 100644 --- a/kubernetes/containerd/centos/containerd.spec +++ b/kubernetes/containerd/centos/containerd.spec @@ -13,6 +13,7 @@ Source1: runc-1.0.0-rc95.tar.gz Source2: crictl-v1.21.0-linux-amd64.tar.gz Source3: crictl.yaml Patch1: 0001-customize-containerd-for-StarlingX.patch +Patch2: 0002-CRI-Reduce-clutter-of-log-entries-during-process-exe.patch URL: https://www.starlingx.io Vendor: StarlingX Packager: StarlingX @@ -57,6 +58,7 @@ low-level storage and network attachments, etc. %setup -q -c -n src -a 1 %setup -q -c -T -D -n src -a 2 %patch1 -p1 +%patch2 -p1 %build # build containerd diff --git a/kubernetes/containerd/centos/files/0002-CRI-Reduce-clutter-of-log-entries-during-process-exe.patch b/kubernetes/containerd/centos/files/0002-CRI-Reduce-clutter-of-log-entries-during-process-exe.patch new file mode 100644 index 000000000..10f349371 --- /dev/null +++ b/kubernetes/containerd/centos/files/0002-CRI-Reduce-clutter-of-log-entries-during-process-exe.patch @@ -0,0 +1,122 @@ +From 80f56a43f5ff7f7d10689a21a004279345221f70 Mon Sep 17 00:00:00 2001 +From: Davanum Srinivas +Date: Wed, 6 Jan 2021 08:57:31 -0500 +Subject: [PATCH] [CRI] Reduce clutter of log entries during process execution + +Signed-off-by: Davanum Srinivas +--- + .../containerd/cri/pkg/server/container_execsync.go | 4 ++-- + .../cri/pkg/server/instrumented_service.go | 12 ++++++------ + .../containerd/cri/pkg/server/io/container_io.go | 4 ++-- + .../containerd/cri/pkg/server/io/exec_io.go | 2 +- + 4 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/containerd/vendor/github.com/containerd/cri/pkg/server/container_execsync.go b/containerd/vendor/github.com/containerd/cri/pkg/server/container_execsync.go +index 1c019f651..17c2bd39d 100644 +--- a/containerd/vendor/github.com/containerd/cri/pkg/server/container_execsync.go ++++ b/containerd/vendor/github.com/containerd/cri/pkg/server/container_execsync.go +@@ -164,14 +164,14 @@ func (c *criService) execInternal(ctx context.Context, container containerd.Cont + } + // Wait for the process to be killed. + exitRes := <-exitCh +- log.G(ctx).Infof("Timeout received while waiting for exec process kill %q code %d and error %v", ++ log.G(ctx).Debugf("Timeout received while waiting for exec process kill %q code %d and error %v", + execID, exitRes.ExitCode(), exitRes.Error()) + <-attachDone + log.G(ctx).Debugf("Stream pipe for exec process %q done", execID) + return nil, errors.Wrapf(execCtx.Err(), "timeout %v exceeded", opts.timeout) + case exitRes := <-exitCh: + code, _, err := exitRes.Result() +- log.G(ctx).Infof("Exec process %q exits with exit code %d and error %v", execID, code, err) ++ log.G(ctx).Debugf("Exec process %q exits with exit code %d and error %v", execID, code, err) + if err != nil { + return nil, errors.Wrapf(err, "failed while waiting for exec %q", execID) + } +diff --git a/containerd/vendor/github.com/containerd/cri/pkg/server/instrumented_service.go b/containerd/vendor/github.com/containerd/cri/pkg/server/instrumented_service.go +index 2c2528ab6..74bebe858 100644 +--- a/containerd/vendor/github.com/containerd/cri/pkg/server/instrumented_service.go ++++ b/containerd/vendor/github.com/containerd/cri/pkg/server/instrumented_service.go +@@ -247,12 +247,12 @@ func (in *instrumentedService) ExecSync(ctx context.Context, r *runtime.ExecSync + if err := in.checkInitialized(); err != nil { + return nil, err + } +- log.G(ctx).Infof("ExecSync for %q with command %+v and timeout %d (s)", r.GetContainerId(), r.GetCmd(), r.GetTimeout()) ++ log.G(ctx).Debugf("ExecSync for %q with command %+v and timeout %d (s)", r.GetContainerId(), r.GetCmd(), r.GetTimeout()) + defer func() { + if err != nil { + log.G(ctx).WithError(err).Errorf("ExecSync for %q failed", r.GetContainerId()) + } else { +- log.G(ctx).Infof("ExecSync for %q returns with exit code %d", r.GetContainerId(), res.GetExitCode()) ++ log.G(ctx).Debugf("ExecSync for %q returns with exit code %d", r.GetContainerId(), res.GetExitCode()) + log.G(ctx).Debugf("ExecSync for %q outputs - stdout: %q, stderr: %q", r.GetContainerId(), + res.GetStdout(), res.GetStderr()) + } +@@ -265,13 +265,13 @@ func (in *instrumentedService) Exec(ctx context.Context, r *runtime.ExecRequest) + if err := in.checkInitialized(); err != nil { + return nil, err + } +- log.G(ctx).Infof("Exec for %q with command %+v, tty %v and stdin %v", ++ log.G(ctx).Debugf("Exec for %q with command %+v, tty %v and stdin %v", + r.GetContainerId(), r.GetCmd(), r.GetTty(), r.GetStdin()) + defer func() { + if err != nil { + log.G(ctx).WithError(err).Errorf("Exec for %q failed", r.GetContainerId()) + } else { +- log.G(ctx).Infof("Exec for %q returns URL %q", r.GetContainerId(), res.GetUrl()) ++ log.G(ctx).Debugf("Exec for %q returns URL %q", r.GetContainerId(), res.GetUrl()) + } + }() + res, err = in.c.Exec(ctrdutil.WithNamespace(ctx), r) +@@ -282,12 +282,12 @@ func (in *instrumentedService) Attach(ctx context.Context, r *runtime.AttachRequ + if err := in.checkInitialized(); err != nil { + return nil, err + } +- log.G(ctx).Infof("Attach for %q with tty %v and stdin %v", r.GetContainerId(), r.GetTty(), r.GetStdin()) ++ log.G(ctx).Debugf("Attach for %q with tty %v and stdin %v", r.GetContainerId(), r.GetTty(), r.GetStdin()) + defer func() { + if err != nil { + log.G(ctx).WithError(err).Errorf("Attach for %q failed", r.GetContainerId()) + } else { +- log.G(ctx).Infof("Attach for %q returns URL %q", r.GetContainerId(), res.Url) ++ log.G(ctx).Debugf("Attach for %q returns URL %q", r.GetContainerId(), res.Url) + } + }() + res, err = in.c.Attach(ctrdutil.WithNamespace(ctx), r) +diff --git a/containerd/vendor/github.com/containerd/cri/pkg/server/io/container_io.go b/containerd/vendor/github.com/containerd/cri/pkg/server/io/container_io.go +index c66549ca5..c69cadd6c 100644 +--- a/containerd/vendor/github.com/containerd/cri/pkg/server/io/container_io.go ++++ b/containerd/vendor/github.com/containerd/cri/pkg/server/io/container_io.go +@@ -114,7 +114,7 @@ func (c *ContainerIO) Pipe() { + c.stdout.Close() + c.stdoutGroup.Close() + wg.Done() +- logrus.Infof("Finish piping stdout of container %q", c.id) ++ logrus.Debugf("Finish piping stdout of container %q", c.id) + }() + } + +@@ -127,7 +127,7 @@ func (c *ContainerIO) Pipe() { + c.stderr.Close() + c.stderrGroup.Close() + wg.Done() +- logrus.Infof("Finish piping stderr of container %q", c.id) ++ logrus.Debugf("Finish piping stderr of container %q", c.id) + }() + } + } +diff --git a/containerd/vendor/github.com/containerd/cri/pkg/server/io/exec_io.go b/containerd/vendor/github.com/containerd/cri/pkg/server/io/exec_io.go +index 4a695030d..f1b9ef370 100644 +--- a/containerd/vendor/github.com/containerd/cri/pkg/server/io/exec_io.go ++++ b/containerd/vendor/github.com/containerd/cri/pkg/server/io/exec_io.go +@@ -99,7 +99,7 @@ func (e *ExecIO) Attach(opts AttachOptions) <-chan struct{} { + } + e.closer.wg.Done() + wg.Done() +- logrus.Infof("Finish piping %q of container exec %q", t, e.id) ++ logrus.Debugf("Finish piping %q of container exec %q", t, e.id) + } + + if opts.Stdout != nil { +-- +2.25.1 +