Re: Current log files when rotating?

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Current log files when rotating?
Date: 2008-11-11 11:54:11
Message-ID: 20081111115411.GF2459@frubble.xen.chris-lamb.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Nov 10, 2008 at 02:30:41PM -0800, Steve Atkins wrote:
> On Nov 10, 2008, at 1:35 PM, Tom Lane wrote:
> >Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> >>It seems that there is enough need for this feature, that it has been
> >>implemented multiple times -- but most of them will fail in corner
> >>cases. Seems an obvious candidate for an in-core function ...
> >
> >... which will still fail in corner cases. Not to mention the race
> >condition when the logger has just/is about to switch.
>
> Also, it's going to be a fairly rare app that will need to both
> look at the current logfile and access the database, so providing
> visibility via a sql function seem clunky.

Indeed, logfiles seem to be in a different world than from inside the
database. It seems there are a couple of options; go and ask PG when
you want to know (pg_ctl seems like a reasonable place IMHO) or have
PG tell you when it's rotating logs, ala the current archiving of WAL
files.

> Maybe just have the logger maintain a symlink to the current
> logfile,

If used; a log archival program could do this.

> or log to a static filename and only use a dynamically
> generated filename when renaming the log file during rotation?

However, this seems like a simpler solution altogether---no need to even
ask as you know the answer already!

This does still leave the question of whether there should be a log
archival program around to tell you when they actually rotate. Going
by the fact that people appear to cope with the current behavior, this
just seems unnecessarily complicated and can reasonably be delayed for a
while.

Sam

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sergey Konoplev 2008-11-11 12:02:13 Re: Very slow queries w/ NOT IN preparation (seems like a bug, test case)
Previous Message Joao Ferreira gmail 2008-11-11 11:52:14 Re: merge 2 dumps