From b6b60dfa1afc5adcfc34d1f03eb4d7cd2d22bbcc Mon Sep 17 00:00:00 2001 From: Seokho Son Date: Wed, 2 Oct 2024 21:43:50 +0900 Subject: [PATCH 1/3] Staging cb-tumblebug v0.9.14 --- docker-compose.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 59334f0b4..71ed0afbe 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,7 +7,7 @@ networks: services: # CB-Tumblebug cb-tumblebug: - image: cloudbaristaorg/cb-tumblebug:0.9.13 + image: cloudbaristaorg/cb-tumblebug:0.9.14 container_name: cb-tumblebug build: context: . @@ -145,7 +145,7 @@ services: # cb-mapui cb-mapui: - image: cloudbaristaorg/cb-mapui:0.9.7 + image: cloudbaristaorg/cb-mapui:0.9.8 container_name: cb-mapui # build: # context: ../cb-mapui From 74331155ffac58eb49e2427fb0679823c26c03af Mon Sep 17 00:00:00 2001 From: Seokho Son Date: Fri, 4 Oct 2024 14:37:04 +0900 Subject: [PATCH 2/3] Refine API request logging stuct --- src/api/rest/server/middlewares/zerologger.go | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/api/rest/server/middlewares/zerologger.go b/src/api/rest/server/middlewares/zerologger.go index 1f5e95490..753dc3e1b 100644 --- a/src/api/rest/server/middlewares/zerologger.go +++ b/src/api/rest/server/middlewares/zerologger.go @@ -42,33 +42,35 @@ func Zerologger(skipPatterns [][]string) echo.MiddlewareFunc { // HandleError: true, // forwards error to the global error handler, so it can decide appropriate status code LogValuesFunc: func(c echo.Context, v middleware.RequestLoggerValues) error { if v.Error == nil { - log.Info(). - Str("id", v.RequestID). - Str("client_ip", v.RemoteIP). - //Str("host", v.Host). - Str("method", v.Method). - Str("URI", v.URI). - //Str("user_agent", v.UserAgent). - Int("status", v.Status). - //Int64("latency", v.Latency.Nanoseconds()). - Str("latency_human", v.Latency.String()). - Str("bytes_in", v.ContentLength). - Int64("bytes_out", v.ResponseSize). - Msg("request") + if v.Method != "OPTIONS" { + log.Info(). + Str("ID", v.RequestID). + Str("Method", v.Method). + Str("URI", v.URI). + Str("clientIP", v.RemoteIP). + //Str("host", v.Host). + //Str("user_agent", v.UserAgent). + Int("status", v.Status). + //Int64("latency", v.Latency.Nanoseconds()). + Str("latency", v.Latency.String()). + //Str("bytes_in", v.ContentLength). + //Int64("bytes_out", v.ResponseSize). + Msg("request") + } } else { log.Error(). Err(v.Error). - Str("id", v.RequestID). - Str("client_ip", v.RemoteIP). - // Str("host", v.Host). - Str("method", v.Method). + Str("ID", v.RequestID). + Str("Method", v.Method). Str("URI", v.URI). + Str("clientIP", v.RemoteIP). + // Str("host", v.Host). //Str("user_agent", v.UserAgent). Int("status", v.Status). // Int64("latency", v.Latency.Nanoseconds()). - Str("latency_human", v.Latency.String()). - Str("bytes_in", v.ContentLength). - Int64("bytes_out", v.ResponseSize). + Str("latency", v.Latency.String()). + //Str("bytes_in", v.ContentLength). + //Int64("bytes_out", v.ResponseSize). Msg("request error") } return nil From d248fe13c4453cc199f195dcf2cdcd04265a6b3d Mon Sep 17 00:00:00 2001 From: Seokho Son Date: Fri, 4 Oct 2024 14:40:50 +0900 Subject: [PATCH 3/3] Staging v0.9.15 --- docker-compose.yaml | 2 +- src/api/rest/server/middlewares/zerologger.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 71ed0afbe..a2831f8ac 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,7 +7,7 @@ networks: services: # CB-Tumblebug cb-tumblebug: - image: cloudbaristaorg/cb-tumblebug:0.9.14 + image: cloudbaristaorg/cb-tumblebug:0.9.15 container_name: cb-tumblebug build: context: . diff --git a/src/api/rest/server/middlewares/zerologger.go b/src/api/rest/server/middlewares/zerologger.go index 753dc3e1b..aaaaf2c46 100644 --- a/src/api/rest/server/middlewares/zerologger.go +++ b/src/api/rest/server/middlewares/zerologger.go @@ -1,6 +1,7 @@ package middlewares import ( + "net/http" "strings" "github.com/labstack/echo/v4" @@ -42,7 +43,7 @@ func Zerologger(skipPatterns [][]string) echo.MiddlewareFunc { // HandleError: true, // forwards error to the global error handler, so it can decide appropriate status code LogValuesFunc: func(c echo.Context, v middleware.RequestLoggerValues) error { if v.Error == nil { - if v.Method != "OPTIONS" { + if v.Method != http.MethodOptions { log.Info(). Str("ID", v.RequestID). Str("Method", v.Method).