|
|
| · · · · · · · | |
pgAdmin 1.6 online documentation22.3. Log File Maintenance It is a good idea to save the database server's log output
somewhere, rather than just routing it to If you simply direct the stderr of
A better approach is to send the server's
stderr output to some type of log rotation program.
There is a built-in log rotation program, which you can use by
setting the configuration parameter Alternatively, you might prefer to use an external log rotation
program, if you have one that you are already using with other
server software. For example, the rotatelogs
tool included in the Apache distribution
can be used with PostgreSQL. To do this,
just pipe the server's
stderr output to the desired program.
If you start the server with
pg_ctl start | rotatelogs /var/log/pgsql_log 86400
Another production-grade approach to managing log output is to
send it all to syslog and let
syslog deal with file rotation. To do this, set the
configuration parameter On many systems, however, syslog is not very reliable,
particularly with large log messages; it may truncate or drop messages
just when you need them the most. Also, on Linux,
syslog will sync each message to disk, yielding poor
performance. (You can use a Note that all the solutions described above take care of starting new log files at configurable intervals, but they do not handle deletion of old, no-longer-interesting log files. You will probably want to set up a batch job to periodically delete old log files. Another possibility is to configure the rotation program so that old log files are overwritten cyclically. |