From f4f2503d4f94c3b31c94587f06cb0b6cce7b7a1d Mon Sep 17 00:00:00 2001 From: Jaydipkumar Arvindbhai Gabani Date: Wed, 31 Jan 2024 12:18:51 -0800 Subject: [PATCH] fix: fixing panic in error log (#3246) Signed-off-by: Jaydip Gabani (cherry picked from commit f70410b2eb89d18feca2a2998c4d960c8edb5b2c) --- pkg/audit/manager.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/audit/manager.go b/pkg/audit/manager.go index d93e911a07d..163285cbeca 100644 --- a/pkg/audit/manager.go +++ b/pkg/audit/manager.go @@ -510,7 +510,7 @@ func (am *Manager) auditFromCache(ctx context.Context) ([]Result, []error) { excluded, err := am.skipExcludedNamespace(&obj) if err != nil { - am.log.Error(err, "Unable to exclude object namespace for audit from cache %v %s/%s", obj.GroupVersionKind().String(), obj.GetNamespace(), obj.GetName()) + am.log.Error(err, fmt.Sprintf("Unable to exclude object namespace for audit from cache %v %s/%s", obj.GroupVersionKind().String(), obj.GetNamespace(), obj.GetName())) continue } @@ -525,7 +525,7 @@ func (am *Manager) auditFromCache(ctx context.Context) ([]Result, []error) { } resp, err := am.opa.Review(ctx, au, drivers.Stats(*logStatsAudit)) if err != nil { - am.log.Error(err, "Unable to review object from audit cache %v %s/%s", obj.GroupVersionKind().String(), obj.GetNamespace(), obj.GetName()) + am.log.Error(err, fmt.Sprintf("Unable to review object from audit cache %v %s/%s", obj.GroupVersionKind().String(), obj.GetNamespace(), obj.GetName())) continue }