X-Git-Url: https://git.madduck.net/etc/mailfilter.git/blobdiff_plain/4f7fed650f35de2eada637d565f5e7d1c611d8c5..9a919c3de59ddf85e27d7a7848bd1c1a78ad8bfc:/procmail/logging diff --git a/procmail/logging b/procmail/logging index 1fc2c7d..7068e4d 100644 --- a/procmail/logging +++ b/procmail/logging @@ -5,15 +5,35 @@ MSGIDDIR=$PMVAR/msgid :0 * MSGID ?? ^<\/[^>]+ { - THISLOGFILE_REL=`echo $MATCH | tr -d "'\"?[:cntrl:]" | tr ' /*' '__+'`%$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 @@ -21,9 +41,9 @@ original-to: $ORIGINAL_TO subject: $SUBJECT$NL" TRAP="DESTFILE=\"\${LASTFOLDER#$BASE/}\"; - /usr/bin/lockfile -4 -r5 -l180 $PMVAR/lock; + /usr/bin/lockfile -4 -r50 -l180 $PMVAR/lock; trap \"echo >> '$THISLOGFILE'; /bin/cat '$THISLOGFILE' >> $MASTERLOGFILE; /bin/rm -f $PMVAR/lock\" 0" -#VERBOSE=yes +THISLOGFILE_REL