[pmg-devel] applied: [PATCH pmg-api v2] Add rule name to RuleAction logging
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Apr 24 14:29:03 CEST 2019
Am 4/18/19 um 5:04 PM schrieb Stoiko Ivanov:
> With complicated rulesets knowing which rule is responsible for the action
> applied to a mail can become complex. Since relevant actions [0] do log a line
> when being executed adding the rule's name to this logline should simplify
> understanding and debugging complex rules.
>
> Additionally the mix of string interpolation and formatstrings in Quarantine.pm
> got unified to formatstrings.
>
> [0] Attach is covered via Notify, Disclaimer and ModField could result in too
> verbose logging (i.e. users adding many headers to a mail) without any gain
>
> Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
> ---
>
> Thanks to Thomas for catching the syntax-error from my removing encode without
> testing!
>
> Changes v1 -> v2:
> * fixed the misplaced ')'
> * tested each testable logline for similar errors (only ReportSpam remains
> untested, but it does not seem that this can be configured easily (i.e. without
> manually inserting stuff into the DB) - I'd consider dropping the Action
> (with a separate patch)
>
>
> extra-info for v1:
> Initially the patch did encode the RuleName as UTF-8, until I noticed that we
> do not support that yet (interaction between Postgres and Perl - see #2057)
> when creating a rule. Adding wider/complete support for UTF-8 for writing/
> reading from the database should also probably happen while reading/writing
> the Database (and is a fight for another day).
>
> AFAIS the only caller of the execute subs of the Actions is bin/pmg-smtp-filter
>
> My (quick) tests included sending a mail with that patch applied and checking
> that the logs still show up in the Tracking Center.
>
> PMG/RuleDB/Accept.pm | 6 ++++--
> PMG/RuleDB/BCC.pm | 8 +++++---
> PMG/RuleDB/Block.pm | 4 +++-
> PMG/RuleDB/Notify.pm | 8 +++++---
> PMG/RuleDB/Quarantine.pm | 6 ++++--
> PMG/RuleDB/Remove.pm | 10 ++++++----
> PMG/RuleDB/ReportSpam.pm | 3 +++
> 7 files changed, 30 insertions(+), 15 deletions(-)
>
applied, thanks!
More information about the pmg-devel
mailing list