* [pmg-devel] [PATCH pmg-api] fix #5966: ruledb: modify header: log action
@ 2025-10-02 14:30 Stoiko Ivanov
0 siblings, 0 replies; only message in thread
From: Stoiko Ivanov @ 2025-10-02 14:30 UTC (permalink / raw)
To: pmg-devel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-10-02 14:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-02 14:30 [pmg-devel] [PATCH pmg-api] fix #5966: ruledb: modify header: log action Stoiko Ivanov
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.