Re: log rotation - Mailing list pgsql-novice

From Tom Lane
Subject Re: log rotation
Date
Msg-id 16076.1142695575@sss.pgh.pa.us
Whole thread Raw
In response to log rotation  (Michael Guerin <guerin@rentec.com>)
Responses Re: log rotation  (Michael Guerin <guerin@rentec.com>)
List pgsql-novice
Michael Guerin <guerin@rentec.com> writes:
>    Can I get rid of the number extension at the end of my log file
> name?  What I'd like to do is keep one log file that truncates after a
> certain amount of time or size, however postgres keeps appending to the
> name I choose?

You haven't really thought this through: what would happen after the
file filled up?  If Postgres truncates it then you'd instantly lose
all log entries before that time, which is surely not what you want.

The usual arrangement is to set up a rotating cycle of log file names,
such as one for each day of the week if you want a week's worth of log
history, or one for each hour of the day if you want a day's worth,
etc.  Then the oldest file gets truncated and rewritten each time the
logger shifts to a new file name.  To do this, you change log_filename
to use a suitable %-item in the file name.  See the examples in the manual.

            regards, tom lane

pgsql-novice by date:

Previous
From: Michael Guerin
Date:
Subject: log rotation
Next
From: Michael Guerin
Date:
Subject: Re: log rotation