-
Notifications
You must be signed in to change notification settings - Fork 736
base: finer grained log filtering in vlog
#30202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
WillemKauf
wants to merge
6
commits into
redpanda-data:dev
Choose a base branch
from
WillemKauf:log_filter
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e04c162
`base`: add per-callsite vlog filter gates
WillemKauf 7c4ee5c
`base`: dispatch on callsite state for 3-way gating
WillemKauf 86e58ab
proto/admin: add log filter AdminV2 endpoint
WillemKauf 963b340
redpanda: wire up log filter service
WillemKauf 3d9a9c6
`rptest`: regenerate protos
WillemKauf 3580c93
bazel: point at temporary seastar fork
WillemKauf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| // Copyright 2026 Redpanda Data, Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| syntax = "proto3"; | ||
|
|
||
| package redpanda.core.admin.v2.internal; | ||
|
|
||
| import "proto/redpanda/core/pbgen/options.proto"; | ||
| import "proto/redpanda/core/pbgen/rpc.proto"; | ||
|
|
||
| option (pbgen.cpp_namespace) = "proto::admin"; | ||
|
|
||
| // State value written onto every callsite a LogFilterRule matches, or | ||
| // reported by ListLogCallsites as the resolved state for a callsite. | ||
| enum LogFilterState { | ||
| // Proto3 default — rejected by SetLogFilter as INVALID_ARGUMENT, | ||
| // never returned by ListLogCallsites. | ||
| LOG_FILTER_STATE_UNSPECIFIED = 0; | ||
| // Callsite falls through to the logger's configured level gate. | ||
| LOG_FILTER_STATE_INHERITED = 1; | ||
| // Callsite emits regardless of the configured level. | ||
| LOG_FILTER_STATE_FORCE_ON = 2; | ||
| // Callsite is suppressed regardless of the configured level. | ||
| LOG_FILTER_STATE_FORCE_OFF = 3; | ||
| } | ||
|
|
||
| // A filter rule applied to every registered vlog callsite. Every populated | ||
| // predicate must match for the rule to apply: file is an fnmatch(3) glob | ||
| // against the callsite's __FILE__, line matches __LINE__ as described | ||
| // below, and contains is a substring search against the format-string | ||
| // literal. An empty rule (no predicates set) matches every callsite. | ||
| // Rules in a list are applied in order; the last matching rule's state | ||
| // value wins. A callsite matching no rule resolves to | ||
| // LOG_FILTER_STATE_INHERITED. | ||
| message LogFilterRule { | ||
| // fnmatch(3) glob pattern matched against the callsite's __FILE__. | ||
| optional string file = 1; | ||
| // Predicate on __LINE__. Accepts exactly one or two entries: a | ||
| // single value matches that line, two values [lo, hi] match the | ||
| // inclusive range lo <= __LINE__ <= hi. Any other size is rejected | ||
| // with INVALID_ARGUMENT. | ||
| repeated uint32 line = 2; | ||
| // Substring that must appear in the format-string literal. | ||
| optional string contains = 3; | ||
| // State written to every site the rule matches. | ||
| LogFilterState state = 4; | ||
| } | ||
|
|
||
| // A registered vlog callsite and its current enabled state. | ||
| message LogCallsiteInfo { | ||
| // Source-file basename (path stripped at compile time). | ||
| string file = 1; | ||
| // Source line. | ||
| uint32 line = 2; | ||
| // Format-string literal at the call site. | ||
| string fmt = 3; | ||
| // Resolved state for this callsite. | ||
| LogFilterState state = 4; | ||
| } | ||
|
|
||
| message SetLogFilterRequest { | ||
| // Rule list that replaces the currently active rules. Every registered | ||
| // callsite is re-evaluated against the new set. To add a rule to the | ||
| // active set, fetch the current rules with GetLogFilter, append to | ||
| // that list client-side, and resubmit here. | ||
| repeated LogFilterRule rules = 1; | ||
| } | ||
| message SetLogFilterResponse {} | ||
|
|
||
| message ResetLogFilterRequest {} | ||
| message ResetLogFilterResponse {} | ||
|
|
||
| message GetLogFilterRequest {} | ||
| message GetLogFilterResponse { | ||
| // Current active rules, in application order (last match wins). | ||
| repeated LogFilterRule rules = 1; | ||
| } | ||
|
|
||
| message ListLogCallsitesRequest { | ||
| // If set, only return callsites whose file matches this fnmatch(3) glob. | ||
| optional string file_filter = 1; | ||
| } | ||
| message ListLogCallsitesResponse { | ||
| repeated LogCallsiteInfo callsites = 1; | ||
| } | ||
|
|
||
| // LogFilterService controls the per-callsite vlog filter on the node that | ||
| // handles the RPC. Filter state is a per-node property — to apply the same | ||
| // filter cluster-wide, call each broker directly. | ||
| service LogFilterService { | ||
| // Replace the active rule set with the supplied rules and re-evaluate | ||
| // every registered callsite against them. | ||
| rpc SetLogFilter(SetLogFilterRequest) returns (SetLogFilterResponse) { | ||
| option (pbgen.rpc) = { | ||
| authz: SUPERUSER, | ||
| }; | ||
| } | ||
| // Clear every rule and re-enable every callsite. | ||
| rpc ResetLogFilter(ResetLogFilterRequest) returns (ResetLogFilterResponse) { | ||
| option (pbgen.rpc) = { | ||
| authz: SUPERUSER, | ||
| }; | ||
| } | ||
| // Return the currently active filter rules in application order. | ||
| rpc GetLogFilter(GetLogFilterRequest) returns (GetLogFilterResponse) { | ||
| option (pbgen.rpc) = { | ||
| authz: SUPERUSER, | ||
| }; | ||
| } | ||
| // Enumerate all registered callsites and their current enabled state. | ||
| rpc ListLogCallsites(ListLogCallsitesRequest) | ||
| returns (ListLogCallsitesResponse) { | ||
| option (pbgen.rpc) = { | ||
| authz: SUPERUSER, | ||
| }; | ||
| } | ||
| } | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
LogCallsiteInfo.filefield comment says the value is a basename with the path stripped, butcs.file()comes from__FILE__(and the PR description suggests matching on paths likesrc/v/storage/*). Either update the comment to describe the actual value (e.g.__FILE__path as compiled), or change the implementation to strip to basename before returning it to clients so the API matches its documentation.