admin: add group-based logging control
Commit Message:
Added support for group-based logging control via the /logging admin endpoint. Users can now change log levels for predefined groups of loggers using /logging?group=<group_name>:<level> (e.g., /logging?group=http:trace). This feature requires fine-grain logging to be enabled and simplifies debugging by allowing log level changes for entire subsystems with a single command instead of manually specifying individual file patterns.
Implemented 16 predefined logger groups covering major Envoy subsystems: http, router, network, upstream, connection, admin, config, grpc, filter, listener, tls, quic, tracing, stats, runtime, and secret. Each group maps to relevant source file patterns, allowing comprehensive debugging of specific components.
Additional Description: This PR addresses the feature request in #42434 to add group-based logging support. The implementation includes:
- Static map of 16 predefined logger groups in
LogsHandler::getLoggerGroups() - Group parameter parsing with whitespace trimming for flexible input
- Validation for group names, log levels, and fine-grain logging enablement
- Comprehensive unit tests covering valid/invalid inputs and whitespace handling
- Updated admin endpoint parameter documentation
The groups cover frequently debugged areas including networking (http, network, connection, quic, tls), routing (router, upstream), configuration (config, runtime, secret), and observability (stats, tracing, admin, grpc).
Risk Level: Low Small feature addition that extends existing logging functionality without changing core behavior.
Testing:
- Unit tests in
logs_handler_test.cccovering:- Valid group names with log level changes
- Invalid group names, empty parameters, invalid levels
- Whitespace handling around delimiters
- Multiple files matching group patterns
- Error message formatting
- Verified logic with standalone C++ tests (all passed)
- Manual testing not possible on macOS x86_64 due to build limitations
Docs Changes:
- Updated admin endpoint parameter description in
source/server/admin/admin.cc - Added usage documentation in help text output
Release Notes:
Added to changelogs/current.yaml under admin section documenting the new feature and listing all 16 available groups.
Platform Specific Features: N/A
Fixes #42434
Hi @MayorFaj, welcome and thank you for your contribution.
We will try to review your Pull Request as quickly as possible.
In the meantime, please take a look at the contribution guidelines if you have not done so already.
CC @envoyproxy/coverage-shephards: FYI only for changes made to (test/coverage.yaml).
envoyproxy/coverage-shephards assignee is @RyanTheOptimist
CC @envoyproxy/runtime-guard-changes: FYI only for changes made to (source/common/runtime/runtime_features.cc).
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @adisuissa
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).
CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to (bazel/.*repos.*\.bzl)|(bazel/dependency_imports\.bzl)|(api/bazel/.*\.bzl)|(.*/requirements\.txt)|(.*\.patch).
envoyproxy/dependency-shepherds assignee is @agrawroh
Waiting on the triggers to pass.
/wait
Waiting on the triggers to pass.
/wait
are the test flaky, or do I need to do anything to fix this?
/retest
Assigning @botengyao as the creator of the issue (#42434). /assign @botengyao