Skip to content

Commit

Permalink
chore: log skipped files on debug level
Browse files Browse the repository at this point in the history
  • Loading branch information
rgmz committed Oct 7, 2024
1 parent 59c615a commit 19119fd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/handlers/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/handlers/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 19119fd

Please sign in to comment.