procmail
[Top] [All Lists]

Re: Conrolling large log files

2004-10-13 04:36:56
On Tue, Oct 12, 2004 at 07:41:01PM -0600, Justin Gombos wrote:
* Michelle Konzack <linux4michelle(_at_)freenet(_dot_)de> [2004-10-09 10:40]:
Hello, 

Activating of "Verbose=on" is no option for me, because a one-time
download of 179 Mailboxes let my procmail.log explode to more then
8 MBytes. 

I deal with the huge infinitely growing logfile issue by using the
following (abridged) code at the top of my main script:

PROCESSED_YEAR = `date +"%Y"`
PROCESSED_WOY  = `date +"%V"`

LOGFILE = $HOME/logs/procmail_$PROCESSED_WOY-${PROCESSED_YEAR}.log

So I end up branching into a new log file every week.

Okay, but assuming you invoke procmail with the -f- option (see
the man pages), each message is already telling you the year in
the From_ (top) line; and it's trivial to grab it without forking
date.  It's the last numerical string in the line.  Hell, let's
even introduce a Y3K weakness in the regex. :-)

  :0
  * ^^From .* \/[2[0-9]+$
  * MATCH ?? ^^\/.*
  { PROCESSED_YEAR = $MATCH }


Here is from my test-harness log:

 procmail: Assigning "MATCH="
 procmail: Matched "2004
 "
 procmail: Match on "^^From .* \/[2[0-9]+$"
 procmail: Matched "2004"
 procmail: Match on "^^\/.*"
 procmail: Assigning "PROCESSED_YEAR=2004"

-- 
dman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>