Re: rotatelog / logrotate with PostgreSQL - Mailing list pgsql-general

From Oliver Elphick
Subject Re: rotatelog / logrotate with PostgreSQL
Date
Msg-id 1032888520.4965.4.camel@linda
Whole thread Raw
In response to Re: rotatelog / logrotate with PostgreSQL  (Yury Bokhoncovich <byg@center-f1.ru>)
List 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.Elphick@lfix.co.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


pgsql-general by date:

Previous
From: "Peter Darley"
Date:
Subject: Re: "Custom" records?
Next
From: Tom Lane
Date:
Subject: Re: rotatelog / logrotate with PostgreSQL