Skip to content

Commit

Permalink
fix: Exclude /metrics from log
Browse files Browse the repository at this point in the history
  • Loading branch information
hez2010 committed Apr 14, 2024
1 parent 8eabce1 commit be3fa79
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/GZCTF/Utils/LogHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ public static ILogger GetLogger(IConfiguration configuration, IServiceProvider s
.Enrich.FromLogContext()
.Filter.ByExcluding(
Matching.WithProperty<string>("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 &&
Expand Down

0 comments on commit be3fa79

Please sign in to comment.