X-Git-Url: https://git.madduck.net/etc/mailfilter.git/blobdiff_plain/83d4115fec90a607a7ba805b04ac970043615e0a..c3d55a5719b81c63c76cd118f47cd56b68a2be9d:/procmail/logging diff --git a/procmail/logging b/procmail/logging index a1e199a..67d7712 100644 --- a/procmail/logging +++ b/procmail/logging @@ -5,18 +5,39 @@ MSGIDDIR=$PMVAR/msgid :0 * MSGID ?? ^<\/[^>]+ { - THISLOGFILE_REL=`echo $MATCH | tr -d "'\"?[:cntrl:]" | tr ' /*$' '__+S'`%$OURDATE_SHORT + MSGID_NAME=`echo $MATCH | tr -d "'\"?[:cntrl:]" | tr ' /*$' '__+S'` + + #VERBOSE=yes + # check if filename > 228 characters and if so, then shorten it to prevent + # hitting filesystem limit after we append the timestamp + :0 + * MSGID_NAME ?? ^..................................................................................................................................................................................................................................... + { + HASH=`echo $MSGID_NAME | md5sum | cut -d' ' -f1` + MSGID_NAME=`echo $MSGID_NAME | cut -c-196`$HASH + } + + THISLOGFILE_REL=$MSGID_NAME%$OURDATE_SHORT THISLOGFILE="$MSGIDDIR/$THISLOGFILE_REL" + + MSGID_NAME + #VERBOSE=no } MASTERLOGFILE="$LOGFILE" LOGFILE="$THISLOGFILE" -LOG="============================================================================== -msgid: $MSGID +LOG="==============================================================================$NL" + +:0 +* LOGLATER ?? . +{ LOG="$LOGLATER" } + +LOG="msgid: $MSGID logfile: $THISLOGFILE_REL date: $DATE (@$OURDATE) from: $FROM +sender: $SENDER original-to: $ORIGINAL_TO subject: $SUBJECT$NL" @@ -26,4 +47,4 @@ TRAP="DESTFILE=\"\${LASTFOLDER#$BASE/}\"; /bin/cat '$THISLOGFILE' >> $MASTERLOGFILE; /bin/rm -f $PMVAR/lock\" 0" -#VERBOSE=yes +THISLOGFILE_REL