guacsec / guac

GUAC aggregates software security metadata into a high fidelity graph database.
https://guac.sh
Apache License 2.0
1.29k stars 176 forks source link

Log error format is not very readable #429

Open lumjjb opened 1 year ago

lumjjb commented 1 year ago

Currently when the logger emits an error, it writes the entire stack trace in 1 line, which is very difficult to read. It would be good to have this printed across a multi-line log message.

For example:

{"level":"error","ts":1676073949.824918,"caller":"spdx/parse_spdx.go:181","msg":"error generating spdx edge node type mismatch during contains edge creation","stacktrace":"github.com/guacsec/guac/pkg/ingestor/parser/spdx.(*spdxParser).CreateEdges\n\t/go/src/github.com/guacsec/guac/pkg/ingestor/parser/spdx/parse_spdx.go:181\ngithub.com/guacsec/guac/pkg/ingestor/parser/common.(*GraphBuilder).CreateAssemblerInput\n\t/go/src/github.com/guacsec/guac/pkg/ingestor/parser/common/graph_builder.go:42\ngithub.com/guacsec/guac/pkg/ingestor/parser.ParseDocumentTree\n\t/go/src/github.com/guacsec/guac/pkg/ingestor/parser/parser.go:124\ngithub.com/guacsec/guac/pkg/ingestor/parser.Subscribe.func1\n\t/go/src/github.com/guacsec/guac/pkg/ingestor/parser/parser.go:90\ngithub.com/guacsec/guac/pkg/emitter.(*pubSub).GetDataFromNats\n\t/go/src/github.com/guacsec/guac/pkg/emitter/nats_data.go:49\ngithub.com/guacsec/guac/pkg/ingestor/parser.Subscribe\n\t/go/src/github.com/guacsec/guac/pkg/ingestor/parser/parser.go:108\ngithub.com/guacsec/guac/cmd/ingest/cmd.getIngestor.func1\n\t/go/src/github.com/guacsec/guac/cmd/ingest/cmd/ingest.go:156\ngithub.com/guacsec/guac/cmd/ingest/cmd.glob..func2.4\n\t/go/src/github.com/guacsec/guac/cmd/ingest/cmd/ingest.go:127"}

lumjjb commented 1 year ago

@naveensrinivasan would this be of interest to you?