Re: rotatelog / logrotate with PostgreSQL

Поиск
Список
Период
Сортировка
От Yury Bokhoncovich
Тема Re: rotatelog / logrotate with PostgreSQL
Дата
Msg-id Pine.LNX.4.33.0209242156070.26040-100000@panda.center-f1.ru
обсуждение исходный текст
Ответ на Re: rotatelog / logrotate with PostgreSQL  (Roland Roberts <roland@astrofoto.org>)
Ответы Re: rotatelog / logrotate with PostgreSQL  (Oliver Elphick <olly@lfix.co.uk>)
Список pgsql-general
Hello!

On 24 Sep 2002, Roland Roberts wrote:

> >>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
>
>     Tom> "Johnson, Shaunn" <SJohnson6@bcbsm.com> writes:
>     >> Can someone send an example of how they have the
>     >> logrotate / rotatelog script working with PostgreSQL?
>
>     Tom> Should work to just pipe the postmaster's stderr into it, eg
>
>     Tom>     postmaster ... 2>&1 | logrotate ...  &
>
> Huh?  logrotate moves a log file, it doesn't log anything.

Agreed.=)

>
> 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.

Try this:

./configure blah-blah-blah --enable-syslog
make&&make install and so on

then

postgresql.conf:
# requires ENABLE_SYSLOG
syslog = 2 # range 0-2
syslog_facility = 'LOCAL2'
syslog_ident = 'postgres'

logrotate.d/postgres:
/path/postgres.log
{
    daily
    compress
    delaycompress
    rotate 10
    notifempty
    create 640 root postgres
}

syslogd.conf:
local2.*                                                /path/postgres.log

--
WBR, Yury Bokhoncovich, Senior System Administrator, NOC of F1 Group.
Phone: +7 (3832) 106228, ext.140, E-mail: byg@center-f1.ru.
Unix is like a wigwam -- no Gates, no Windows, and an Apache inside.



В списке pgsql-general по дате отправления:

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: grant/revoke for alter/drop?
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Number of disk pages obtained by explain analyze (fwd)