| PostgreSQL Reference Manual - Volume 3 - Server Administration Guide by The PostgreSQL Global Development Group Paperback (6"x9"), 204 pages ISBN 0954612043 RRP £13.95 ($24.95) Sales of this book support the PostgreSQL project! Get a printed copy>>> |
4.7.1 Where To Log
log_destination(string)-
PostgreSQL supports several methods
for logging server messages, including
stderrandsyslog. On Windows,eventlogis also supported. Set this parameter to a list of desired log destinations separated by commas. The default is to log tostderronly. This parameter can only be set in the ‘postgresql.conf’ file or on the server command line. redirect_stderr(boolean)- This parameter allows messages sent to stderr to be captured and redirected into log files. This method, in combination with logging to stderr, is often more useful than logging to syslog, since some types of messages may not appear in syslog output (a common example is dynamic-linker failure messages). This parameter can only be set at server start.
log_directory(string)-
When
redirect_stderris enabled, this parameter determines the directory in which log files will be created. It may be specified as an absolute path, or relative to the cluster data directory. This parameter can only be set in the ‘postgresql.conf’ file or on the server command line. log_filename(string)-
When
redirect_stderris enabled, this parameter sets the file names of the created log files. The value is treated as astrftimepattern, so%-escapes can be used to specify time-varying file names. If no%-escapes are present, PostgreSQL will append the epoch of the new log file's open time. For example, iflog_filenamewereserver_log, then the chosen file name would beserver_log.1093827753for a log starting at Sun Aug 29 19:02:33 2004 MST. This parameter can only be set in the ‘postgresql.conf’ file or on the server command line. log_rotation_age(integer)-
When
redirect_stderris enabled, this parameter determines the maximum lifetime of an individual log file. After this many minutes have elapsed, a new log file will be created. Set to zero to disable time-based creation of new log files. This parameter can only be set in the ‘postgresql.conf’ file or on the server command line. log_rotation_size(integer)-
When
redirect_stderris enabled, this parameter determines the maximum size of an individual log file. After this many kilobytes have been emitted into a log file, a new log file will be created. Set to zero to disable size-based creation of new log files. This parameter can only be set in the ‘postgresql.conf’ file or on the server command line. log_truncate_on_rotation(boolean)-
When
redirect_stderris enabled, this parameter will cause PostgreSQL to truncate (overwrite), rather than append to, any existing log file of the same name. However, truncation will occur only when a new file is being opened due to time-based rotation, not during server startup or size-based rotation. When off, pre-existing files will be appended to in all cases. For example, using this setting in combination with alog_filenamelikepostgresql-%H.logwould result in generating twenty-four hourly log files and then cyclically overwriting them. This parameter can only be set in the ‘postgresql.conf’ file or on the server command line. Example: To keep 7 days of logs, one log file per day namedserver_log.Mon,server_log.Tue, etc, and automatically overwrite last week's log with this week's log, setlog_filenametoserver_log.%a,log_truncate_on_rotationtoon, andlog_rotation_ageto1440. Example: To keep 24 hours of logs, one log file per hour, but also rotate sooner if the log file size exceeds 1GB, setlog_filenametoserver_log.%H%M,log_truncate_on_rotationtoon,log_rotation_ageto60, andlog_rotation_sizeto1000000. Including%Minlog_filenameallows any size-driven rotations that may occur to select a file name different from the hour's initial file name. syslog_facility(string)-
When logging to syslog is enabled, this parameter
determines the syslog
“facility” to be used. You may choose
from
LOCAL0,LOCAL1,LOCAL2,LOCAL3,LOCAL4,LOCAL5,LOCAL6,LOCAL7; the default isLOCAL0. See also the documentation of your system's syslog daemon. This parameter can only be set in the ‘postgresql.conf’ file or on the server command line. syslog_ident(string)-
When logging to syslog is enabled, this parameter
determines the program name used to identify
PostgreSQL messages in
syslog logs. The default is
postgres. This parameter can only be set in the ‘postgresql.conf’ file or on the server command line.
| ISBN 0954612043 | PostgreSQL Reference Manual - Volume 3 - Server Administration Guide | See the print edition |