From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api] fix #5966: ruledb: modify header: log action
Date: Thu, 2 Oct 2025 16:30:57 +0200 [thread overview]
Message-ID: <20251002143158.25682-1-s.ivanov@proxmox.com> (raw)
ModField (modify header) is the only action which we currently do not
log. Originally I skipped it explicitly, expecting this to add too
many lines on an average system. However it does prevent some
situations from being debugged correctly (as laid out in #5966), and
I don't think that the argument of too many log-lines outweighs that.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
minimally tested on my pmg-setup (with mails to discard€@testdomain,
discard@testdomain) to verify the logs look ok.
src/PMG/RuleDB/ModField.pm | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/PMG/RuleDB/ModField.pm b/src/PMG/RuleDB/ModField.pm
index 849726f8..bf08a18e 100644
--- a/src/PMG/RuleDB/ModField.pm
+++ b/src/PMG/RuleDB/ModField.pm
@@ -6,6 +6,8 @@ use DBI;
use Digest::SHA;
use Encode qw(encode decode);
+use PVE::SafeSyslog;
+
use PMG::Utils;
use PMG::ModGroup;
use PMG::RuleDB::Object;
@@ -100,9 +102,20 @@ sub execute {
my $subgroups = $mod_group->subgroups($targets);
+ my $rulename = encode('UTF-8', $vars->{RULE} // 'unknown');
+
foreach my $ta (@$subgroups) {
my ($tg, $e) = (@$ta[0], @$ta[1]);
$e->head->replace($self->{field}, $fvalue);
+ my $targets = join('>, <', @$tg);
+ syslog(
+ 'info',
+ "%s: modified header '%s' for <%s> (rule: %s)",
+ $queue->{logid},
+ encode('UTF-8', $self->{field}),
+ encode('UTF-8', $targets),
+ $rulename,
+ );
}
}
--
2.47.3
_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel
reply other threads:[~2025-10-02 14:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20251002143158.25682-1-s.ivanov@proxmox.com \
--to=s.ivanov@proxmox.com \
--cc=pmg-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.