From 81b366e2c8907d04816cb05a3237f0f469612e75 Mon Sep 17 00:00:00 2001 From: Karl Persson Date: Thu, 5 Oct 2023 16:11:36 +0200 Subject: [PATCH] AuthN: Make logger less noisy (#76044) * Change to debug for token needs rotation errors --- pkg/services/authn/authnimpl/service.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/services/authn/authnimpl/service.go b/pkg/services/authn/authnimpl/service.go index 4f3c5e0c2bf..2a2e165eac9 100644 --- a/pkg/services/authn/authnimpl/service.go +++ b/pkg/services/authn/authnimpl/service.go @@ -226,7 +226,12 @@ func (s *Service) authenticate(ctx context.Context, c authn.Client, r *authn.Req r.OrgID = orgIDFromRequest(r) identity, err := c.Authenticate(ctx, r) if err != nil { - s.log.FromContext(ctx).Warn("Failed to authenticate request", "client", c.Name(), "error", err) + log := s.log.FromContext(ctx).Warn + if errors.Is(err, authn.ErrTokenNeedsRotation) { + log = s.log.FromContext(ctx).Debug + } + + log("Failed to authenticate request", "client", c.Name(), "error", err) return nil, err }