spicedb-operator icon indicating copy to clipboard operation
spicedb-operator copied to clipboard

Support JSON logging format in operator

Open ivanauth opened this issue 3 months ago • 0 comments

Summary

  • Add --log-format flag to support JSON logging output
  • Enable structured logging for better integration with log aggregation systems

Description

This PR adds support for JSON-formatted logs in the SpiceDB Operator, addressing issue #349. By default, the operator uses text-based logging, but operators can now use the --log-format=json flag to enable structured JSON logging.

Changes

  • Added --log-format flag to the run command with validation
  • Integrated zap logger for JSON output when requested
  • Updated controller to accept logger as a parameter instead of creating hardcoded instances
  • Added comprehensive tests for the new functionality
  • Added example deployment manifest showing JSON logging configuration
  • Added documentation explaining the feature and integration with log aggregation systems

Testing

  • Added unit tests for log format validation
  • Added integration tests verifying JSON output format
  • Updated existing controller tests to pass logger parameter
  • All tests pass successfully

Backward Compatibility

  • Default behavior unchanged (text format)
  • No breaking changes to existing deployments
  • Empty log format defaults to text

Fixes #349

ivanauth avatar Nov 26 '25 23:11 ivanauth