Skip to content

zoekt: use structured logging for all of zoekt

Created by: gl-srgr

Message logging is handled via simple logging approach utilizing the builtin log package. Structured JSON logging would provide improved read/parse/query capabilities.

Issue 34951 implements this type of logging for a small scope of operations, specifically two indexing related operations conducted by zoekt-sourcegraph-indexserver. This issue's acceptance criteria is to expand the scope of structured logging to all of zoekt.

Current plan (update on 2022 June 15): Repository sourcegraph/log was created recently and our first attempt of integrating that structured logging is in PR 374.

Alternatives if sourcegraph/log needs to be removed:

  • Instead of logfmt for structured logs sourcegraph uses an internal logging standard compliant with OpenTelemtry's model. This doc describes the sourcegraph logging configuration. Would compliance with this model be a requirement of zoekt's structured json logging?
  • If we do not import a logging solution then we can utilize zap loggers in zoekt. For an example of what this would look like see PR 355.
  • log15 is another logging package that's utilized by the deprecated sourcegraph logging

The aforementioned considerations and other questions/concerns discussed in this slack thread.