Обсуждение: entries in serverlog file

Поиск
Список
Период
Сортировка

entries in serverlog file

От
"Tena Sakai"
Дата:

Hi everybody,

I have, by default, on a linux machine, a file called
serverlog in the data directory, whose entries often
prove to be very useful.  What would be even more useful
would be a timestamp along with each entry.

Is there any way I can add such timestamp at this point?
Perhaps via postgresql.conf file (also in the data directory)?

Thank you in advance.

Regards,

Tena Sakai
tsakai@gallo.ucsf.edu

Re: entries in serverlog file

От
"Joshua D. Drake"
Дата:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tena Sakai wrote:
> Hi everybody,
>
> I have, by default, on a linux machine, a file called
> serverlog in the data directory, whose entries often
> prove to be very useful.  What would be even more useful
> would be a timestamp along with each entry.
>
> Is there any way I can add such timestamp at this point?
> Perhaps via postgresql.conf file (also in the data directory)?
>
> Thank you in advance.

http://www.postgresql.org/docs/current/interactive/runtime-config-logging.html

>
> Regards,
>
> Tena Sakai
> tsakai@gallo.ucsf.edu
>


- --

      === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive  PostgreSQL solutions since 1997
             http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGu4q7ATb/zqfZUUQRAgzrAJ9yatkzIfZgj7TxmhbaWigehhPVEQCfZoVO
n6Y80pi9LtTd9nvfd4rEeFw=
=zPj9
-----END PGP SIGNATURE-----

Re: entries in serverlog file

От
"Kevin Grittner"
Дата:
>>> On Thu, Aug 9, 2007 at  4:37 PM, in message
<FE44E0D7EAD2ED4BB2165071DB8E328C03062B24@egcrc-ex01.egcrc.org>, "Tena Sakai"
<tsakai@gallo.ucsf.edu> wrote:
> I have, by default, on a linux machine, a file called
> serverlog in the data directory, whose entries often
> prove to be very useful.  What would be even more useful
> would be a timestamp along with each entry.
>
> Is there any way I can add such timestamp at this point?
> Perhaps via postgresql.conf file (also in the data directory)?

By all means, do read the documentation referred to by Joshua.

For a quick starting point, we have found it useful to use
these settings:

redirect_stderr = on
log_line_prefix = '[%m] %p %q<%u %d %r> '




Re: entries in serverlog file

От
"Tena Sakai"
Дата:

Hi Joshua,
Hi Kevin,

Many thanks for your suggestions/advices.
I am reading chapter 17 of the manual, which in the hindsight,
I should have read a month ago.  But this is very good.  I am
making haste slowly.

Thanks again.

Regards,

Tena Sakai
tsakai@gallo.ucsf.edu


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
From Kevin Grittner [Kevin.Grittner@wicourts.gov]

By all means, do read the documentation referred to by Joshua.

For a quick starting point, we have found it useful to use
these settings:

redirect_stderr = on
log_line_prefix = '[%m] %p %q<%u %d %r> '

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

-----Original Message-----
From: Joshua D. Drake [mailto:jd@commandprompt.com]
Sent: Thu 8/9/2007 2:44 PM
To: Tena Sakai
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] entries in serverlog file

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tena Sakai wrote:
> Hi everybody,
>
> I have, by default, on a linux machine, a file called
> serverlog in the data directory, whose entries often
> prove to be very useful.  What would be even more useful
> would be a timestamp along with each entry.
>
> Is there any way I can add such timestamp at this point?
> Perhaps via postgresql.conf file (also in the data directory)?
>
> Thank you in advance.

http://www.postgresql.org/docs/current/interactive/runtime-config-logging.html

>
> Regards,
>
> Tena Sakai
> tsakai@gallo.ucsf.edu
>


- --

      === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive  PostgreSQL solutions since 1997
             http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGu4q7ATb/zqfZUUQRAgzrAJ9yatkzIfZgj7TxmhbaWigehhPVEQCfZoVO
n6Y80pi9LtTd9nvfd4rEeFw=
=zPj9
-----END PGP SIGNATURE-----

Re: entries in serverlog file

От
"Tena Sakai"
Дата:

Hi Everybody,

I have read chapter 17 of the current manual and learned
interesting options.  But as I compare what's in the
postgresql.conf file to what I think I comprehend, I am
a slightly confused:

In the conf file I see log_destination is set as 'stderr'
and redirect_stderr is set as off AND they are both commented
out.  Yet, I am accumulating log entries into serverlog file.
To me this is a fine default setting.  So my question amounts
to be the following:

Can I just uncomment log_line_prefix entry and stick what I want
(such as %u, %d, %m, etc) into the quotes and expect to see the
logged lines be prefixed with username, database name, timestamp,
etc with all other things intact?  I come from change-as-few-
things-as-possible-at-one-time-school.

Thank you in advance.

Regards,

Tena Sakai
tsakai@gallo.ucsf.edu



-----Original Message-----
From: Joshua D. Drake [mailto:jd@commandprompt.com]
Sent: Thu 8/9/2007 2:44 PM
To: Tena Sakai
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] entries in serverlog file

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tena Sakai wrote:
> Hi everybody,
>
> I have, by default, on a linux machine, a file called
> serverlog in the data directory, whose entries often
> prove to be very useful.  What would be even more useful
> would be a timestamp along with each entry.
>
> Is there any way I can add such timestamp at this point?
> Perhaps via postgresql.conf file (also in the data directory)?
>
> Thank you in advance.

http://www.postgresql.org/docs/current/interactive/runtime-config-logging.html

>
> Regards,
>
> Tena Sakai
> tsakai@gallo.ucsf.edu
>


- --

      === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive  PostgreSQL solutions since 1997
             http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGu4q7ATb/zqfZUUQRAgzrAJ9yatkzIfZgj7TxmhbaWigehhPVEQCfZoVO
n6Y80pi9LtTd9nvfd4rEeFw=
=zPj9
-----END PGP SIGNATURE-----

Re: entries in serverlog file

От
Tom Lane
Дата:
"Tena Sakai" <tsakai@gallo.ucsf.edu> writes:
> Can I just uncomment log_line_prefix entry and stick what I want
> (such as %u, %d, %m, etc) into the quotes and expect to see the
> logged lines be prefixed with username, database name, timestamp,
> etc with all other things intact?

Sure; you will however regret by and by that you didn't turn on
redirect_stderr, because there is no way to rotate the logfile
(other than restarting the postmaster) when it's simply going straight
to stderr.  The more verbose you make the log, the sooner its bulk is
going to become a problem...

            regards, tom lane

Re: entries in serverlog file

От
"Tena Sakai"
Дата:

Hi Tom,

Thanks.  I will live a bit dangerously while I
strategize what to do with the logfile.  I am
not sure if 7 day log rotation is really a
wise option for now.  I will come up with
something fitting in time.  Thanks for your
comment, nonetheless.

Regards,

Tena Sakai
tsakai@gallo.ucsf.edu


-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Mon 8/13/2007 12:42 PM
To: Tena Sakai
Cc: Joshua D. Drake; pgsql-admin@postgresql.org
Subject: Re: [ADMIN] entries in serverlog file

"Tena Sakai" <tsakai@gallo.ucsf.edu> writes:
> Can I just uncomment log_line_prefix entry and stick what I want
> (such as %u, %d, %m, etc) into the quotes and expect to see the
> logged lines be prefixed with username, database name, timestamp,
> etc with all other things intact?

Sure; you will however regret by and by that you didn't turn on
redirect_stderr, because there is no way to rotate the logfile
(other than restarting the postmaster) when it's simply going straight
to stderr.  The more verbose you make the log, the sooner its bulk is
going to become a problem...

                        regards, tom lane