From 3c77158b2479582a1956c0324ef5b5d0c64b3657 Mon Sep 17 00:00:00 2001 From: Marco Dinis Date: Tue, 22 Oct 2024 13:57:22 +0100 Subject: [PATCH] Log Audit Error instead of operation error when auditing fails (#47783) --- lib/auth/crownjewel/crownjewelv1/service.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/auth/crownjewel/crownjewelv1/service.go b/lib/auth/crownjewel/crownjewelv1/service.go index 7655098da228b..fa61478600800 100644 --- a/lib/auth/crownjewel/crownjewelv1/service.go +++ b/lib/auth/crownjewel/crownjewelv1/service.go @@ -143,7 +143,7 @@ func (s *Service) emitCreateAuditEvent(ctx context.Context, req *crownjewelv1.Cr }, CrownJewelQuery: req.GetSpec().GetQuery(), }); auditErr != nil { - slog.WarnContext(ctx, "Failed to emit crown jewel create event.", "error", err) + slog.WarnContext(ctx, "Failed to emit crown jewel create event.", "error", auditErr) } } @@ -237,7 +237,7 @@ func (s *Service) emitUpdateAuditEvent(ctx context.Context, old, new *crownjewel CurrentCrownJewelQuery: old.GetSpec().GetQuery(), UpdatedCrownJewelQuery: new.GetSpec().GetQuery(), }); auditErr != nil { - slog.WarnContext(ctx, "Failed to emit crown jewel update event.", "error", err) + slog.WarnContext(ctx, "Failed to emit crown jewel update event.", "error", auditErr) } } @@ -315,7 +315,7 @@ func (s *Service) DeleteCrownJewel(ctx context.Context, req *crownjewelv1.Delete UpdatedBy: authCtx.Identity.GetIdentity().Username, }, }); auditErr != nil { - slog.WarnContext(ctx, "Failed to emit crown jewel delete event.", "error", err) + slog.WarnContext(ctx, "Failed to emit crown jewel delete event.", "error", auditErr) } if err != nil {