From 17e1e4e02538926832b7c2a156eb25a2787b1f5e Mon Sep 17 00:00:00 2001 From: chenjiankun Date: Tue, 8 Mar 2022 10:29:04 +0800 Subject: [PATCH] docker: use info level for create stop command fix #I4WRUY --- VERSION-openeuler | 2 +- docker-engine-openeuler.spec | 8 +++- ...-level-for-create-start-stop-command.patch | 44 +++++++++++++++++++ series.conf | 1 + 4 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 patch/0201-docker-use-info-level-for-create-start-stop-command.patch diff --git a/VERSION-openeuler b/VERSION-openeuler index 57fc215..1b58c0e 100644 --- a/VERSION-openeuler +++ b/VERSION-openeuler @@ -1 +1 @@ -18.09.0.211 +18.09.0.212 diff --git a/docker-engine-openeuler.spec b/docker-engine-openeuler.spec index 5c933cc..e45601f 100644 --- a/docker-engine-openeuler.spec +++ b/docker-engine-openeuler.spec @@ -1,6 +1,6 @@ Name: docker-engine Version: 18.09.0 -Release: 211 +Release: 212 Summary: The open-source application container engine Group: Tools/Docker @@ -201,6 +201,12 @@ fi %endif %changelog +* Tue Mar 8 2022 chenjiankun - 18.09.0-212 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:use info level for create stop command + * Mon Mar 7 2022 chenjiankun - 18.09.0-211 - Type:bugfix - ID:NA diff --git a/patch/0201-docker-use-info-level-for-create-start-stop-command.patch b/patch/0201-docker-use-info-level-for-create-start-stop-command.patch new file mode 100644 index 0000000..8b3533b --- /dev/null +++ b/patch/0201-docker-use-info-level-for-create-start-stop-command.patch @@ -0,0 +1,44 @@ +From 8b41a404dcb0aa7c377b18b5f0627ed379371245 Mon Sep 17 00:00:00 2001 +From: jingrui +Date: Thu, 18 Mar 2021 17:28:20 +0800 +Subject: [PATCH] docker: use info level for create/start/stop command + +Signed-off-by: jingrui +--- + .../engine/api/server/middleware/debug.go | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +diff --git a/components/engine/api/server/middleware/debug.go b/components/engine/api/server/middleware/debug.go +index 31165bf91..2c039aa5d 100644 +--- a/components/engine/api/server/middleware/debug.go ++++ b/components/engine/api/server/middleware/debug.go +@@ -13,10 +13,25 @@ import ( + "github.com/sirupsen/logrus" + ) + ++func isKeyCmd(method string, uri string) bool { ++ if method != "POST" { ++ return false ++ } ++ if !strings.Contains(uri, "containers") { ++ return false ++ } ++ return strings.Contains(uri, "create") || strings.Contains(uri, "start") || strings.Contains(uri, "stop") || strings.Contains(uri, "kill") ++} ++ + // DebugRequestMiddleware dumps the request to logger + func DebugRequestMiddleware(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { + return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { +- logrus.Debugf("Calling %s %s", r.Method, r.RequestURI) ++ if isKeyCmd(r.Method, r.RequestURI) { ++ agent, _ := r.Header["User-Agent"] ++ logrus.Infof("Calling %s %s agent=%v", r.Method, r.RequestURI, agent) ++ } else { ++ logrus.Debugf("Calling %s %s", r.Method, r.RequestURI) ++ } + + if r.Method != "POST" { + return handler(ctx, w, r, vars) +-- +2.23.0 + diff --git a/series.conf b/series.conf index e2d8803..cbee6bf 100644 --- a/series.conf +++ b/series.conf @@ -194,4 +194,5 @@ patch/0197-docker-fix-hijack-hang.patch patch/0198-docker-fix-docker-kill-command-block.patch patch/0199-docker-pkg-archive-fix-TestTarUntarWithXattr-failure-on-rec.patch patch/0200-docker-fix-unit-testcase-error.patch +patch/0201-docker-use-info-level-for-create-start-stop-command.patch #end -- Gitee