Skip to content

Support JSON logging format in operator - #391

Open
ivanauth wants to merge 1 commit into
authzed:mainfrom
ivanauth:fix/issue-349-json-logging
Open

Support JSON logging format in operator#391
ivanauth wants to merge 1 commit into
authzed:mainfrom
ivanauth:fix/issue-349-json-logging

Conversation

@ivanauth

Copy link
Copy Markdown
Contributor

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
ivanauth force-pushed the fix/issue-349-json-logging branch from 20e2c42 to d605fb1 Compare December 13, 2025 02:19
@ivanauth
ivanauth force-pushed the fix/issue-349-json-logging branch from d605fb1 to b40a844 Compare January 8, 2026 22:15
@ivanauth
ivanauth force-pushed the fix/issue-349-json-logging branch from b40a844 to b43c193 Compare January 23, 2026 21:52
Comment thread examples/alternative-registry/README.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this supposed to be part of this PR ?

@ivanauth ivanauth Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No good catch, that was an unrelated commit that got mixed into this branch by mistake.

I've rewritten the branch to contain only the JSON logging change. Dropped from the PR:

  • examples/alternative-registry/
  • pkg/apis/authzed/v1alpha1/types.go
  • pkg/config/config.go, pkg/config/config_test.go
  • pkg/controller/validate_config.go, pkg/controller/validate_config_test.go
  • both authzed.com_spicedbclusters.yaml CRDs

Adds a --log-format flag to the run command, accepting "text" (default)
or "json". When json is requested the operator installs a zap-backed
logr, producing structured output for log aggregation pipelines.

The controller now takes a logger as a parameter rather than
constructing one internally, so the configured format is used
throughout.

Fixes authzed#349
@ivanauth
ivanauth force-pushed the fix/issue-349-json-logging branch from 4086228 to aae315b Compare August 26, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Support JSON Logging

2 participants