From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox v4 1/3] rest-server: add request logfilter by method and path in h2 service
Date: Fri, 24 Jul 2026 13:07:33 +0200 [thread overview]
Message-ID: <20260724110735.464113-2-c.ebner@proxmox.com> (raw)
In-Reply-To: <20260724110735.464113-1-c.ebner@proxmox.com>
Allows to optionally filter incoming requests to be excluded from the
task log. The filter method is provided on instantiation and passes
the request method and path.
A first usecase for this is to filter out HTTP level heartbeat
requests send by the client's backup reader/writer implementation in
order to avoid log flodding.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
proxmox-rest-server/src/h2service.rs | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/proxmox-rest-server/src/h2service.rs b/proxmox-rest-server/src/h2service.rs
index b5edc703..5d53d2e4 100644
--- a/proxmox-rest-server/src/h2service.rs
+++ b/proxmox-rest-server/src/h2service.rs
@@ -16,6 +16,8 @@ use proxmox_router::{ApiResponseFuture, HttpError, Router, RpcEnvironment};
use crate::formatter::*;
use crate::{WorkerTask, normalize_path_with_components};
+type LogFilterFn = Arc<dyn Fn(&hyper::Method, &str) -> bool + Send + Sync>;
+
/// Hyper Service implementation to handle stateful H2 connections.
///
/// We use this kind of service to handle backup protocol
@@ -27,15 +29,23 @@ pub struct H2Service<E> {
rpcenv: E,
worker: Arc<WorkerTask>,
debug: bool,
+ log_filter: Option<LogFilterFn>,
}
impl<E: RpcEnvironment + Clone> H2Service<E> {
- pub fn new(rpcenv: E, worker: Arc<WorkerTask>, router: &'static Router, debug: bool) -> Self {
+ pub fn new(
+ rpcenv: E,
+ worker: Arc<WorkerTask>,
+ router: &'static Router,
+ debug: bool,
+ log_filter: Option<LogFilterFn>,
+ ) -> Self {
Self {
rpcenv,
worker,
router,
debug,
+ log_filter,
}
}
@@ -55,7 +65,14 @@ impl<E: RpcEnvironment + Clone> H2Service<E> {
Err(err) => return future::err(http_err!(BAD_REQUEST, "{}", err)).boxed(),
};
- self.debug(format!("{method} {path}"));
+ if self
+ .log_filter
+ .clone()
+ .map(|filter| filter(&method, &path))
+ .unwrap_or(true)
+ {
+ self.debug(format!("{method} {path}"));
+ }
let mut uri_param = HashMap::new();
--
2.47.3
next prev parent reply other threads:[~2026-07-24 11:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 11:07 [PATCH proxmox{,-backup} v4 0/3] fix #6373: HTTP level keepalive for http2 backup reader/writer connection Christian Ebner
2026-07-24 11:07 ` Christian Ebner [this message]
2026-07-24 11:07 ` [PATCH proxmox-backup v4 2/3] api: add heartbeat endpoint for backup reader/writer http/2 clients Christian Ebner
2026-07-24 11:07 ` [PATCH proxmox-backup v4 3/3] fix #6373: HTTP level client heartbeat for proxy connection keepalive Christian Ebner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260724110735.464113-2-c.ebner@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox