Re: Postgres logs w/ Logrotate

Lists: pgsql-novice
From: "Delao, Darryl W" <ddelao(at)ou(dot)edu>
To: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Cc: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgres logs
Date: 2003-03-27 21:52:17
Message-ID: FC0CEBD77311DA499A67ADB355A24FA2546BD0@mail4.oulan.ou.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

All,

I am having a really hard time getting logging to work in postgres.
What do i need to uncomment and/or change in the .conf file for this to
work. Under var/log i see a file called pgsql but it has nothing in it.
I have played with different ways to try to turn logging on and nothing
works. I want all connection type messages, errors, etc to go to this
file under /var/log

Any help is greatly appreciated!
Thanks!
Darryl


From: "A(dot)Bhuvaneswaran" <bhuvanbk(at)yahoo(dot)com>
To: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Postgres logs
Date: 2003-03-28 04:53:22
Message-ID: Pine.LNX.4.44.0303281021350.5053-100000@Bhuvan.bksys.co.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice


> I am having a really hard time getting logging to work in postgres.
> What do i need to uncomment and/or change in the .conf file for this to
> work. Under var/log i see a file called pgsql but it has nothing in it.
> I have played with different ways to try to turn logging on and nothing
> works. I want all connection type messages, errors, etc to go to this
> file under /var/log

Run pg_ctl with -l option. See postgresql.conf to check details which can
be logged.

regards,
bhuvaneswaran


From: "A(dot)Bhuvaneswaran" <bhuvansql(at)myrealbox(dot)com>
To: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Postgres logs
Date: 2003-03-28 05:06:31
Message-ID: Pine.LNX.4.44.0303281035520.5053-100000@Bhuvan.bksys.co.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

> I am having a really hard time getting logging to work in postgres.
> What do i need to uncomment and/or change in the .conf file for this to
> work. Under var/log i see a file called pgsql but it has nothing in it.
> I have played with different ways to try to turn logging on and nothing
> works. I want all connection type messages, errors, etc to go to this
> file under /var/log

Run pg_ctl with -l option. See postgresql.conf to check details which can
be logged.

regards,
bhuvaneswaran


From: Renê Salomão <rene(at)ibiz(dot)com(dot)br>
To: pgsql-novice(at)postgresql(dot)org
Subject: Postgres logs w/ Logrotate
Date: 2003-03-28 14:35:45
Message-ID: 20030328113545.516faffb.rene@ibiz.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Hi list,

Is there any extra configuration to run postgresql 7.3.2 logs
with logrotate?
I tried the following script at /etc/logrotate.d:

/var/log/postgresql/postgresql.log {
daily
rotate 5
compress
create
}

the problem is that after it does its first rotation (create a
compressed copy of the log) and the new log file created, any new
message originated from postgresql is not saved in log file...

I do start postgres with:

pg_ctl start -o -i -l /var/log/postgresql/postgresql.log

What am I doing wrong? Does Postgresql need to be restarted? How can I
do it?

Tkns
-----------------------------
Renê Salomão
Ibiz Tecnologia -- www.ibiz.com.br
(011) 5579-3178 - R. 211


From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Renê Salomão <rene(at)ibiz(dot)com(dot)br>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Postgres logs w/ Logrotate
Date: 2003-03-31 21:24:48
Message-ID: 1049145888.4073.91.camel@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

On Fri, 2003-03-28 at 14:35, Renê Salomão wrote:
> Hi list,
>
> Is there any extra configuration to run postgresql 7.3.2 logs
> with logrotate?
> I tried the following script at /etc/logrotate.d:
>
> /var/log/postgresql/postgresql.log {
> daily
> rotate 5
> compress
> create
> }
>
> the problem is that after it does its first rotation (create a
> compressed copy of the log) and the new log file created, any new
> message originated from postgresql is not saved in log file...
>
> I do start postgres with:
>
> pg_ctl start -o -i -l /var/log/postgresql/postgresql.log
>
>
> What am I doing wrong? Does Postgresql need to be restarted? How can I
> do it?

You probably need the copytruncate option in your logrotate script. The
postmaster does not close its logfile, so it continues to write to the
file you have rotated out.

--
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
========================================
"If we confess our sins, he is faithful and just to
forgive us our sins, and to cleanse us from all
unrighteousness." I John 1:9


From: Renê Salomão <rene(at)ibiz(dot)com(dot)br>
To: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Postgres logs w/ Logrotate
Date: 2003-04-02 14:05:41
Message-ID: 20030402110541.756043a3.rene@ibiz.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Oliver,

Thank u very much... Copytruncate was exactly what my scripts was
missing.. Just had to replace copytruncate with create...
I lacked the knowledge that postmaster does not close the
file...

By the way is there any environment variable to log path? I know that
there is for data (PGDATA) and port (PGPORT)... What about log (PGLOG)?
Would help a lot if such variable exists!!! The reason is that anyone
here can start/stop/reload our testing database, most of the time
people forget about setting log file...

Thanks...

On 31 Mar 2003 22:24:48 +0100
Oliver Elphick <olly(at)lfix(dot)co(dot)uk> wrote:

> On Fri, 2003-03-28 at 14:35, Renê Salomão wrote:
> > Hi list,
> >
> > Is there any extra configuration to run postgresql 7.3.2 logs
> > with logrotate?
> > I tried the following script at /etc/logrotate.d:
> >
> > /var/log/postgresql/postgresql.log {
> > daily
> > rotate 5
> > compress
> > create
> > }
> >
> > the problem is that after it does its first rotation (create a
> > compressed copy of the log) and the new log file created, any new
> > message originated from postgresql is not saved in log file...
> >
> > I do start postgres with:
> >
> > pg_ctl start -o -i -l /var/log/postgresql/postgresql.log
> >
> >
> > What am I doing wrong? Does Postgresql need to be restarted? How
> > can I
> > do it?
>
> You probably need the copytruncate option in your logrotate script.
> The postmaster does not close its logfile, so it continues to write to
> the file you have rotated out.
>
> --
> 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
> ========================================
> "If we confess our sins, he is faithful and just to
> forgive us our sins, and to cleanse us from all
> unrighteousness." I John 1:9
>
>

-----------------------------
Renê Salomão
Ibiz Tecnologia -- www.ibiz.com.br
(011) 5579-3178 - R. 211


From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Renê Salomão <rene(at)ibiz(dot)com(dot)br>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Postgres logs w/ Logrotate
Date: 2003-04-02 14:23:57
Message-ID: 1049293437.1374.3.camel@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

On Wed, 2003-04-02 at 15:05, Renê Salomão wrote:
> Oliver,
>
> Thank u very much... Copytruncate was exactly what my scripts was
> missing.. Just had to replace copytruncate with create...

I suspect your English is failing you here: you need to replace create
with copytruncate!

> I lacked the knowledge that postmaster does not close the
> file...
>
> By the way is there any environment variable to log path? I know that
> there is for data (PGDATA) and port (PGPORT)... What about log (PGLOG)?

Not that I know of.

> Would help a lot if such variable exists!!! The reason is that anyone
> here can start/stop/reload our testing database, most of the time
> people forget about setting log file...

I should set up a script for them to use, to ensure that it gets done
right every time.

--
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
========================================
"If the Son therefore shall make you free, ye shall be
free indeed." John 8:36