From: Robert Obkircher <r.obkircher@proxmox.com>
To: Christian Ebner <c.ebner@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Subject: Re: [PATCH proxmox v3 1/3] rest-server: add request logfilter by method and path in h2 service
Date: Thu, 23 Jul 2026 16:17:29 +0200 [thread overview]
Message-ID: <178481624960.207559.16327170625450950852.b4-review@b4> (raw)
In-Reply-To: <20260721114806.505047-2-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>
>
> diff --git a/proxmox-rest-server/src/h2service.rs b/proxmox-rest-server/src/h2service.rs
> index b5edc703..be3797dc 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>,
If we expect more complex, stateful filters in the future then
`Option<Arc<dyn Fn>>` would be better.
> }
>
> 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()
This confused me initially, because filters are usually associated
with predicates that return true for the elements that should be
kept.
--
Robert Obkircher <r.obkircher@proxmox.com>
next prev parent reply other threads:[~2026-07-23 14:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 11:48 [PATCH proxmox{,-backup} v3 0/3] fix #6373: HTTP level keepalive for http2 backup reader/writer connection Christian Ebner
2026-07-21 11:48 ` [PATCH proxmox v3 1/3] rest-server: add request logfilter by method and path in h2 service Christian Ebner
2026-07-23 14:17 ` Robert Obkircher [this message]
2026-07-21 11:48 ` [PATCH proxmox-backup v3 2/3] api: add heartbeat endpoint for backup reader/writer http/2 clients Christian Ebner
2026-07-23 14:15 ` Robert Obkircher
2026-07-21 11:48 ` [PATCH proxmox-backup v3 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=178481624960.207559.16327170625450950852.b4-review@b4 \
--to=r.obkircher@proxmox.com \
--cc=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