From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 1FACA1FF0A3 for ; Thu, 01 Oct 2026 10:39:03 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B375121814; Thu, 01 Oct 2026 10:37:45 +0200 (CEST) From: Lukas Wagner To: pbs-devel@lists.proxmox.com, pve-devel@lists.proxmox.com Subject: [PATCH proxmox v2 02/34] notify: log which matchers matched on a notification Date: Thu, 1 Oct 2026 10:36:34 +0200 Message-ID: <20261001083706.144246-3-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261001083706.144246-1-l.wagner@proxmox.com> References: <20261001083706.144246-1-l.wagner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1790843854516 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.450 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: YEWDWCD3FCBRGK47J55VK5ZCZAS5VLAB X-Message-ID-Hash: YEWDWCD3FCBRGK47J55VK5ZCZAS5VLAB X-MailFrom: l.wagner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This should make debugging notification issues much easier. Eventually, this information shall also be recorded in a notification history, but adding the log output is a valuable addition until then. Suggested-by: Arthur Bied-Charreton Signed-off-by: Lukas Wagner --- proxmox-notify/src/matcher.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/proxmox-notify/src/matcher.rs b/proxmox-notify/src/matcher.rs index 9964e4bf..cce86b6c 100644 --- a/proxmox-notify/src/matcher.rs +++ b/proxmox-notify/src/matcher.rs @@ -442,6 +442,7 @@ pub fn check_matches<'a>( notification: &Notification, ) -> HashSet<&'a str> { let mut targets = HashSet::new(); + let mut matching_matchers = Vec::new(); for matcher in matchers { if matcher.disable.unwrap_or_default() { @@ -451,14 +452,27 @@ pub fn check_matches<'a>( } match matcher.matches(notification) { - Ok(t) => { - let t = t.unwrap_or_default(); + Ok(Some(t)) => { + matching_matchers.push(matcher.name.clone()); targets.extend(t.iter().map(|s| s.as_str())); } + Ok(None) => {} Err(err) => error!("matcher '{matcher}' failed: {err}", matcher = matcher.name), } } + if !matching_matchers.is_empty() { + let target_list = Vec::from_iter(targets.clone()); + + info!( + "notification matched the following matchers: {}. The following targets will be notified: {}", + matching_matchers.join(", "), + target_list.join(", ") + ); + } else { + info!("notification was not matched by any matcher"); + } + targets } -- 2.47.3