Skip to content

Commit

Permalink
[CWS] downgrade the "Failed to remove dump" to debug if no exist
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcacheux committed Dec 11, 2024
1 parent 706fa94 commit 1d0739f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/security/security_profile/dump/local_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package dump

import (
"bytes"
"errors"
"fmt"
"os"
"path"
Expand Down Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 1d0739f

Please sign in to comment.