From be3fa79e68c738e2247fae6fbafa9b6cd7a43d53 Mon Sep 17 00:00:00 2001 From: Steven He Date: Sun, 14 Apr 2024 19:20:39 +0900 Subject: [PATCH] fix: Exclude /metrics from log --- src/GZCTF/Utils/LogHelper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GZCTF/Utils/LogHelper.cs b/src/GZCTF/Utils/LogHelper.cs index 2e383837d..4fc60a41d 100644 --- a/src/GZCTF/Utils/LogHelper.cs +++ b/src/GZCTF/Utils/LogHelper.cs @@ -129,7 +129,8 @@ public static ILogger GetLogger(IConfiguration configuration, IServiceProvider s .Enrich.FromLogContext() .Filter.ByExcluding( Matching.WithProperty("RequestPath", v => - "/healthz".Equals(v, StringComparison.OrdinalIgnoreCase) || + v.TrimEnd('/').Equals("/healthz", StringComparison.OrdinalIgnoreCase) || + v.TrimEnd('/').Equals("/metrics", StringComparison.OrdinalIgnoreCase) || v.StartsWith("/assets", StringComparison.OrdinalIgnoreCase))) .Filter.ByExcluding(logEvent => logEvent.Exception != null &&