Add JSON log output format for easier log processing#1609
Merged
Eugeny merged 3 commits intowarp-tech:mainfrom Dec 30, 2025
Merged
Add JSON log output format for easier log processing#1609Eugeny merged 3 commits intowarp-tech:mainfrom
Eugeny merged 3 commits intowarp-tech:mainfrom
Conversation
Add configurable log format (text/json) for easier log processing and integration with log aggregation systems. - Add LogFormat enum with Text (default) and Json variants - Add log.format config option in warpgate.yaml - Add --log-format CLI flag (overrides config) - Add JsonConsoleLayer for NDJSON output to stdout - Include timestamp, level, target, message, and span fields - Add integration tests for both config and CLI options
Contributor
Author
|
Hello @Eugeny, Thanks for this cool project ! Can you please review this PR, it just introduces json logging format on the stdout for the logger! Not sure why the build are failing TBH, I will try to fix it in my branch if there is not other work in progress regarding that 🙏 |
Member
|
Thank you for the PR! CI passes now except the new test - please rewrite it to use the provided test utils - in CI, tests run a special instrumented build of warpgate to measure coverage - the |
Refactor test_json_logs.py to use the existing test infrastructure instead of standalone utilities: - Use ProcessManager and start_wg() from conftest.py - Use wait_port() from util.py - Use timeout fixture for configurable timeouts - Use share_with pattern for proper stdout capture - Remove duplicated alloc_port() and wait_port() functions This ensures tests work correctly with the instrumented build for coverage measurement in CI.
Contributor
Author
|
@Eugeny Test are now passing is there anything needed for this PR to be reviewed 🙏 |
Member
|
Thanks! @all-contributors please add @mrmm for code |
Contributor
|
I've put up a pull request to add @mrmm! 🎉 |
Eugeny
pushed a commit
that referenced
this pull request
Dec 31, 2025
Adds @mrmm as a contributor for code. This was requested by Eugeny [in this comment](#1609 (comment)) --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for JSON-formatted log output, making it easier to integrate Warpgate with log aggregation systems (ELK, Splunk, Datadog, etc.) and automated log processing pipelines.
Logs can be switched to JSON format via configuration file or CLI flag.
Changes
Configuration
LogFormatenum withtext(default) andjsonvariantslog.formatoption inwarpgate.yaml:CLI
--log-formatflag that overrides config:Backend
JsonConsoleLayertracing subscriber layer inwarpgate-core/src/logging/JSON Output Format
Each log line is a valid JSON object:
{"timestamp":"2025-01-15T10:30:45.123Z","level":"info","target":"warpgate::server","message":"Server started","port":2222}Fields:
timestampleveltrace,debug,info,warn,errortargetwarpgate::server)message...Tests
Files Changed
config-schema.json- Updated schema with LogFormatwarpgate-common/Cargo.toml- Added clap dependencywarpgate-common/src/config/mod.rs- LogFormat enum and configwarpgate-core/src/logging/json_console.rs- New JsonConsoleLayerwarpgate-core/src/logging/mod.rs- Module exportwarpgate/src/logging.rs- Layer initializationwarpgate/src/main.rs- CLI argumenttests/test_json_logs.py- Integration testsTesting
All 150 tests pass, including the 2 new JSON logging tests.