Re: rotatelog / logrotate with PostgreSQL

From: "Gaetano Mendola" <mendola(at)bigfoot(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: rotatelog / logrotate with PostgreSQL
Date: 2002-09-25 09:06:35
Message-ID: amruie$3db$2@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

""Johnson, Shaunn"" <SJohnson6(at)bcbsm(dot)com> wrote in message
news:73309C2FDD95D11192E60008C7B1D5BB04C73F9B(at)snt452(dot)corp(dot)bcbsm(dot)com(dot)(dot)(dot)
> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
>
> ------_=_NextPart_001_01C26310.AA038860
> Content-Type: text/plain;
> charset="iso-8859-1"
>
> Howdy:
>
> Running PostgreSQL 7.2.1 on RedHat Linux 7.2 kernel 2.4.7.
>
> Can someone send an example of how they have the
> logrotate / rotatelog script working with PostgreSQL?
> I'm looking at a few things and I can't seem to
> get it to work.

Hi, I seen a lot of reply, but I don't understand why all
of us should crambling on the mirror for resolve a tipical
problem already well solved on Linux box?

Anyway how alread I suggested times ago the following
way ( why don't put this in the documentation or in
the FAQ ? ):

Insert in your postgresql.conf the following lines:

# File postgresql.conf
syslog = 2
syslog_facility = 'LOCAL0'
syslog_ident = 'postgres'

Create a file postgres under your /etc/logrotate/postgres
( the path depend on your installation )

#File postgres
/var/log/postgresql.log {
compress
rotate 2
size=10000k
create 0664 postgres postgres
daily
postrotate
/usr/bin/killall -HUP syslogd
endscript
}

Take a look at the option that you need.

in the syslog.conf add the following lines:

# Save postgresql logs
LOCAL0.* /var/log/postgresql.log

be sure that the file /var/log/postgresql.log is owned by
postgres.

Send a SIGHUP to postmaster and syslog after that setting.
For test if the logrotate is working well force a rotation:

$> logrotate -f /etc/logrotate/postgres

Ciao
Gaetano

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tim Knowles 2002-09-25 09:19:00 Re: Postmaster Uptime
Previous Message Shridhar Daithankar 2002-09-25 07:39:59 Re: Administrator issue