From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox 1/1] rest-server: add request logfilter by method and path in h2 service
Date: Thu, 29 Jan 2026 13:26:58 +0100 [thread overview]
Message-ID: <20260129122700.448448-2-c.ebner@proxmox.com> (raw)
In-Reply-To: <20260129122700.448448-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 implementation in order
to avoid log flodding.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
proxmox-rest-server/src/h2service.rs | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/proxmox-rest-server/src/h2service.rs b/proxmox-rest-server/src/h2service.rs
index 09843477..2645f25e 100644
--- a/proxmox-rest-server/src/h2service.rs
+++ b/proxmox-rest-server/src/h2service.rs
@@ -27,15 +27,23 @@ pub struct H2Service<E> {
rpcenv: E,
worker: Arc<WorkerTask>,
debug: bool,
+ log_filter: Option<fn(&hyper::Method, &str) -> bool>,
}
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<fn(&hyper::Method, &str) -> bool>,
+ ) -> Self {
Self {
rpcenv,
worker,
router,
debug,
+ log_filter,
}
}
@@ -55,7 +63,13 @@ 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
+ .map(|filter| filter(&method, &path))
+ .unwrap_or_default()
+ {
+ self.debug(format!("{method} {path}"));
+ }
let mut uri_param = HashMap::new();
--
2.47.3
next prev parent reply other threads:[~2026-01-29 12:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 12:26 [RFC proxmox{,-backup} 0/3] fix #6373: HTTP level keepalive for http2 backup reader connection Christian Ebner
2026-01-29 12:26 ` Christian Ebner [this message]
2026-01-29 12:26 ` [PATCH proxmox-backup 1/2] fix #6373: HTTP level reader heartbeat for proxy connection keepalive Christian Ebner
2026-01-29 12:27 ` [PATCH proxmox-backup 2/2] api: h2service: avoid logging heartbeat requests to task log 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=20260129122700.448448-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