Skip to content

Find, verify, and analyze leaked credentials

Add per-chunk detection logging (#4152)

Martin Locklearf2c14fb59f1b
diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go
index 957f90c4b..d7f808f35 100644
--- a/pkg/engine/engine.go
+++ b/pkg/engine/engine.go
@@ -1048,7 +1048,14 @@ func (e *Engine) detectChunk(ctx context.Context, data detectableChunk) {
}
defer common.Recover(ctx)
- ctx = context.WithValue(ctx, "detector", data.detector.Key.Loggable())
+ ctx = context.WithValues(ctx,
+ "detector", data.detector.Key.Loggable(),
+ "decoder_type", data.decoder.String(),
+ "chunk_source_name", data.chunk.SourceName,
+ "chunk_source_id", data.chunk.SourceID,
+ "chunk_source_metadata", data.chunk.SourceMetadata.String())
+
+ ctx.Logger().V(4).Info("Starting to detect chunk")
isFalsePositive := detectors.GetFalsePositiveCheck(data.detector.Detector)
@@ -1120,6 +1127,8 @@ func (e *Engine) detectChunk(ctx context.Context, data detectableChunk) {
matchesPerChunk.Observe(float64(matchCount))
+ ctx.Logger().V(4).Info("Finished detecting chunk")
+
data.wgDoneFn()
}