From 19119fdc2ab860db62db6c960b3b19bca15eb229 Mon Sep 17 00:00:00 2001 From: Richard Gomez Date: Mon, 7 Oct 2024 19:44:33 -0400 Subject: [PATCH] chore: log skipped files on debug level --- pkg/engine/engine.go | 2 +- pkg/handlers/archive.go | 8 ++++---- pkg/handlers/default.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index 454330d52d52..4e0ee318df07 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -773,7 +773,7 @@ func (e *Engine) scannerWorker(ctx context.Context) { decodeLatency.WithLabelValues(decoder.Type().String(), chunk.SourceName).Observe(float64(decodeTime)) if decoded == nil { - ctx.Logger().V(4).Info("decoder not applicable for chunk", "decoder", decoder.Type().String(), "chunk", chunk) + ctx.Logger().V(5).Info("decoder not applicable for chunk", "decoder", decoder.Type().String(), "chunk", chunk) continue } diff --git a/pkg/handlers/archive.go b/pkg/handlers/archive.go index d33329f76e89..7d658dfae2c7 100644 --- a/pkg/handlers/archive.go +++ b/pkg/handlers/archive.go @@ -154,10 +154,10 @@ func (h *archiveHandler) extractorHandler(archiveChan chan []byte) func(context. "filename", file.Name(), "size", file.Size(), ) - lCtx.Logger().V(5).Info("Handling extracted file.") + lCtx.Logger().V(3).Info("Handling extracted file.") if file.IsDir() || file.LinkTarget != "" { - lCtx.Logger().V(5).Info("skipping directory or symlink") + lCtx.Logger().V(3).Info("skipping directory or symlink") return nil } @@ -172,13 +172,13 @@ func (h *archiveHandler) extractorHandler(archiveChan chan []byte) func(context. fileSize := file.Size() if int(fileSize) > maxSize { - lCtx.Logger().V(3).Info("skipping file due to size", "size", fileSize) + lCtx.Logger().V(2).Info("skipping file: size exceeds max allowed", "size", fileSize, "max_size", maxSize) h.metrics.incFilesSkipped() return nil } if common.SkipFile(file.Name()) || common.IsBinary(file.Name()) { - lCtx.Logger().V(5).Info("skipping file") + lCtx.Logger().V(2).Info("skipping file: extension is ignored") h.metrics.incFilesSkipped() return nil } diff --git a/pkg/handlers/default.go b/pkg/handlers/default.go index 84e58f07b2c4..31ebbf8b4162 100644 --- a/pkg/handlers/default.go +++ b/pkg/handlers/default.go @@ -76,7 +76,7 @@ func (h *defaultHandler) handleNonArchiveContent(ctx logContext.Context, reader mimeExt := reader.mimeExt if common.SkipFile(mimeExt) || common.IsBinary(mimeExt) { - ctx.Logger().V(5).Info("skipping file", "ext", mimeExt) + ctx.Logger().V(2).Info("skipping file: extension is ignored", "ext", mimeExt) h.metrics.incFilesSkipped() // Make sure we consume the reader to avoid potentially blocking indefinitely. _, _ = io.Copy(io.Discard, reader)