From 9c43ba9dcc3c812430daf6b2e163e9f41f5855de Mon Sep 17 00:00:00 2001 From: Don Bowman Date: Mon, 15 Feb 2021 13:16:27 -0500 Subject: [PATCH] fix: disable DisableHTMLEscape on logrus json logging Fixes #3363 Without this, we emit illegal json logs, the user-agent ends up as: ``` "http.request.useragent": "docker/19.03.4 go/go1.12.10 git-commit/9013bf583a kernel/5.10.10-051010-generic os/linux arch/amd64 UpstreamClient(Docker-Client/19.03.4 \(linux\))" ``` which is not valid according to [spec](https://www.json.org/json-en.html) specifically, string: "*" Signed-off-by: Don Bowman --- registry/registry.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/registry/registry.go b/registry/registry.go index 95dc3caa..488d6372 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -277,7 +277,8 @@ func configureLogging(ctx context.Context, config *configuration.Configuration) switch formatter { case "json": log.SetFormatter(&log.JSONFormatter{ - TimestampFormat: time.RFC3339Nano, + TimestampFormat: time.RFC3339Nano, + DisableHTMLEscape: true, }) case "text": log.SetFormatter(&log.TextFormatter{