diff --git a/pkg/fanal/analyzer/sbom/sbom.go b/pkg/fanal/analyzer/sbom/sbom.go index 9bd2d52d85ab..55768cff3a9b 100644 --- a/pkg/fanal/analyzer/sbom/sbom.go +++ b/pkg/fanal/analyzer/sbom/sbom.go @@ -37,7 +37,7 @@ func (a sbomAnalyzer) Analyze(ctx context.Context, input analyzer.AnalysisInput) return nil, xerrors.Errorf("failed to detect SBOM format: %w", err) } - ctx = log.WithContextAttrs(ctx, log.String("file", input.FilePath)) + ctx = log.WithContextAttrs(ctx, log.FilePath(input.FilePath)) bom, err := sbom.Decode(ctx, input.Content, format) if err != nil { return nil, xerrors.Errorf("SBOM decode error: %w", err) diff --git a/pkg/fanal/artifact/sbom/sbom.go b/pkg/fanal/artifact/sbom/sbom.go index 2dad9ddf8607..782a32d9b1f8 100644 --- a/pkg/fanal/artifact/sbom/sbom.go +++ b/pkg/fanal/artifact/sbom/sbom.go @@ -51,7 +51,7 @@ func (a Artifact) Inspect(ctx context.Context) (artifact.Reference, error) { } log.Info("Detected SBOM format", log.String("format", string(format))) - ctx = log.WithContextAttrs(ctx, log.String("file", a.filePath)) + ctx = log.WithContextAttrs(ctx, log.FilePath(a.filePath)) bom, err := sbom.Decode(ctx, f, format) if err != nil { return artifact.Reference{}, xerrors.Errorf("SBOM decode error: %w", err) diff --git a/pkg/fanal/handler/unpackaged/unpackaged.go b/pkg/fanal/handler/unpackaged/unpackaged.go index ee5f176e7224..07925d9596f0 100644 --- a/pkg/fanal/handler/unpackaged/unpackaged.go +++ b/pkg/fanal/handler/unpackaged/unpackaged.go @@ -64,7 +64,7 @@ func (h unpackagedHook) Handle(ctx context.Context, res *analyzer.AnalysisResult } // Parse the fetched SBOM - ctx = log.WithContextAttrs(ctx, log.String("file", filePath)) + ctx = log.WithContextAttrs(ctx, log.FilePath(filePath)) bom, err := sbom.Decode(ctx, bytes.NewReader(raw), format) if err != nil { return err