From 1d0739fc94bc054709f3c60894ebc6fef1e69107 Mon Sep 17 00:00:00 2001 From: Paul Cacheux Date: Wed, 11 Dec 2024 08:32:37 +0100 Subject: [PATCH] [CWS] downgrade the "Failed to remove dump" to debug if no exist --- pkg/security/security_profile/dump/local_storage.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/security/security_profile/dump/local_storage.go b/pkg/security/security_profile/dump/local_storage.go index a1fa0c334806d..9f48d17df654a 100644 --- a/pkg/security/security_profile/dump/local_storage.go +++ b/pkg/security/security_profile/dump/local_storage.go @@ -10,6 +10,7 @@ package dump import ( "bytes" + "errors" "fmt" "os" "path" @@ -87,7 +88,11 @@ func NewActivityDumpLocalStorage(cfg *config.Config, m *ActivityDumpManager) (Ac // remove everything for _, filePath := range *filePaths { if err := os.Remove(filePath); err != nil { - seclog.Warnf("Failed to remove dump %s (limit of dumps reach): %v", filePath, err) + logFn := seclog.Warnf + if errors.Is(err, os.ErrNotExist) { + logFn = seclog.Debugf + } + logFn("Failed to remove dump %s (limit of dumps reach): %v", filePath, err) } }