Re: more contrib: log rotator - Mailing list pgsql-hackers

From Ed L.
Subject Re: more contrib: log rotator
Date
Msg-id 200304041004.25267.pgsql@bluepolka.net
Whole thread Raw
In response to Re: more contrib: log rotator  ("scott.marlowe" <scott.marlowe@ihs.com>)
Responses Re: more contrib: log rotator  ("Ed L." <pgsql@bluepolka.net>)
List pgsql-hackers
On Friday April 4 2003 9:16, scott.marlowe wrote:
>
> That said, a log rotation capability built right into pg_ctl or
> thereabouts would be a very nice feature.  I.e. 'pg_ctl -r 86400 -l
> $PGDATA/logs/pgsql start'
>
> where -r is the rotation period in seconds.  If it's an external program
> that pg_ctl calls that's fine, and it could even just be a carbon copy of
> apache's log rotater if their license is compatible (isn't it?)

By way of feature ideas, one very convenient but not widely used feature of
Apache's log rotator is the ability to specify a strftime() format string
for the file extension.  For example, if I want to have my logs rollover
every 24 hours and be named log.Mon, log.Tue, log.Wed, I say something like
pg_ctl start | rotatelogs 86400 "%a"

This causes the logs to overwrite themselves every seven days, taking log
maintenance time to very near zero.  We also customized our use of it to
allow us to automatically move existing logs out of the way to "log.1",
"log.2", or to simply overwrite existing logs.

Ed



pgsql-hackers by date:

Previous
From: "Ed L."
Date:
Subject: .sequence_name != ?
Next
From: "Ed L."
Date:
Subject: Re: more contrib: log rotator