Re: rotatelog / logrotate with PostgreSQL

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Yury Bokhoncovich <byg(at)center-f1(dot)ru>
Cc: Roland Roberts <roland(at)astrofoto(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: rotatelog / logrotate with PostgreSQL
Date: 2002-09-24 17:28:39
Message-ID: 1032888520.4965.4.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2002-09-24 at 16:05, Yury Bokhoncovich wrote:
> > Does the postmaster close the log after writing? logrotate can move
>
> IIRC it closes file only on HUP or so, don't wanna to seek in sources.
> So if you don't use syslog, place killall -HUP `tail -n1 /pidpath/postmaster.pid`
> to postrotate clause and better use delaycompress if any.

> > the log and create a new (empty) one, but if the postmaster has the
> > log open, it will continue to write to the old one, defeating the
> > purpose of rotating the log. Also, if logrotate is configured to
> > compress the log after rotating, an open connection will result in the
> > tail of the file being "corrupted" since uncompressed data will be
> > appended.

Use logrotate's copytruncate option to rotate an open file (when not
using syslog). There is a small possibility of losing some log data in
between copying the log file and truncating it.

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"And we know that all things work together for good to
them that love God, to them who are the called
according to his purpose."
Romans 8:28

In response to

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2002-09-24 17:33:18 Re: [GENERAL] PGXLOG variable worthwhile?
Previous Message Peter Darley 2002-09-24 16:50:36 Re: "Custom" records?