Hello,
the attached patch adds a log macro report_json_filtered to amavisd.
This macro is like report_json but will remove all specified fields from
the output.
Example:
$logline_maxlen = ( 32*1024 ) - 50; # 32k max message size, keep 50 bytes for
syslog
$log_templ = <<'EOD';
[:report_json_filtered|@timestamp|subject|subject_rot13|time_iso_week_date|time_unix|digest_body|type|user_agent|partition|originating]
EOD
It may be usefull for filtering unused fields to save diskspace and to
avoid logging of message content (subject, user_agent).
Markus
diff --git a/amavisd b/amavisd
index f50a708..8b03f60 100755
--- a/amavisd
+++ b/amavisd
@@ -12383,6 +12383,18 @@ sub init_builtin_macros() {
structured_report_update_time($report_ref);
return Amavis::JSON::encode($report_ref); # as a string of characters
},
+ # a filtered version of json report
+ report_json_filtered => sub {
+ return if !$report_ref;
+ structured_report_update_time($report_ref);
+ my $filtered = { %$report_ref };
+ foreach my $key ( @_ ) {
+ if( defined $filtered->{$key} ) {
+ delete $filtered->{$key};
+ }
+ }
+ return Amavis::JSON::encode($filtered);
+ },
# macros f, T, C, B will be defined for each notification as appropriate
# (representing From:, To:, Cc:, and Bcc: respectively)
# remaining free letters: wxEGIJKLMYZ