Unix Technical Forum

entries in serverlog file

This is a discussion on entries in serverlog file within the pgsql Admins forums, part of the PostgreSQL category; --> Hi everybody, I have, by default, on a linux machine, a file called serverlog in the data directory, whose ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Admins

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 08:05 AM
Tena Sakai
 
Posts: n/a
Default entries in serverlog file

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 08:05 AM
Joshua D. Drake
 
Posts: n/a
Default Re: 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/curre...g-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-----

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-10-2008, 08:05 AM
Kevin Grittner
 
Posts: n/a
Default Re: entries in serverlog file

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




---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-10-2008, 08:05 AM
Tena Sakai
 
Posts: n/a
Default Re: entries in serverlog file

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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-10-2008, 08:05 AM
Tena Sakai
 
Posts: n/a
Default Re: entries in serverlog file

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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-10-2008, 08:05 AM
Tom Lane
 
Posts: n/a
Default Re: 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

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-10-2008, 08:05 AM
Tena Sakai
 
Posts: n/a
Default Re: entries in serverlog file

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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:26 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com