The FreeBSD Diary

The FreeBSD Diary (TM) Remember
I remember
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

Scripts / handy tips
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 PostgreSQL Logging
Author: Dan 
Date:   26-09-06 11:45

Sometimes it is useful to have PostgreSQL log things. Here is what I use in /usr/local/pgsql/data/postgresql.php. I put these entries at the end of the file, where they are easier to find.

syslog_facility = 'LOCAL0'
syslog_ident = 'postgres'
log_statement = all
client_min_messages = error
log_min_messages = error
redirect_stderr = on
log_destination = 'stderr,syslog'
log_duration = on

log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_rotation_age = 86400
stats_command_string = on
log_line_prefix = '%m %d %p '

You will need to create the pg_log directory (the default logging location):

mkdir /usr/local/pgsql/data/pg_log
chown pgsql:pgsql /usr/local/pgsql/data/pg_log

The first time you ask PostgreSQL to log, you'll need to restart it.

/usr/local/etc/rc.d/010.pgsql.sh restart

If you're just making changes to the configuration, log_line_prefix for example, then you had just reload (aka HUP):

/usr/local/etc/rc.d/010.pgsql.sh reload

Logging can produce large log files, especially if you are logging every SQL statement on a busy database.

--
Webmaster

Reply To This Message
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org