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

From Gaetano Mendola
Subject Re: rotatelog / logrotate with PostgreSQL
Date
Msg-id amruie$3db$2@news.hub.org
Whole thread Raw
In response to rotatelog / logrotate with PostgreSQL  ("Johnson, Shaunn" <SJohnson6@bcbsm.com>)
Responses Re: rotatelog / logrotate with PostgreSQL  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-general
""Johnson, Shaunn"" <SJohnson6@bcbsm.com> wrote in message
news:73309C2FDD95D11192E60008C7B1D5BB04C73F9B@snt452.corp.bcbsm.com...
> 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
















pgsql-general by date:

Previous
From: "Shridhar Daithankar"
Date:
Subject: Re: Administrator issue
Next
From: "Tim Knowles"
Date:
Subject: Re: Postmaster Uptime