I run postgres as a service with cygrunsrv.
According to cygrunsrv's README, it may one day
be able to pipe stdout/stderr. But not yet.
So if you do a standard installation,
/var/log/postmaster.log grows indefinitely.
Here is a way to renew the log file regularly:
- get the rotatelogs component from the apache
package:
. download the apache package with setup.exe
. copy release\apache\apache-<version>.tar.bz2
in /tmp
. cd /
. tar -jxf /tmp/apache*.bz2
usr/share/man/man8/rotatelogs.8
usr/sbin/rotatelogs.exe
- change some parameters of cygrunsrv --install
or directly change them in the registry
(HKLM\System\CurrentControlSet\Services\postmaster)
�-path /usr/bin/bash.exe
--args "--login -c \'/usr/local/pgsql/bin/postmaster
-D /usr/share/pgsql/data �i -c log_timestamp=1 2>&1 |
/usr/sbin/rotatelogs /var/log/pgsql 604800\'"
Notes:
- I run a 7.3.6 version, so you may have to adjust
the paths to postmaster and data to different new
settings.
- I'm used to set --login when I run a bash.
Didn't check if it's really mandatory here.
- 604800 means a week in seconds.
It seems to work fine.
But one minor defect is that these 3 lines do not
appear in the log when the service is stopped:
<datetime> LOG: fast shutdown request
<datetime> LOG: shutting down
<datetime> LOG: database system is shut down
I guess that rotatelogs.exe is terminated even before
to get the last output of postgres.exe.
Any idea to improve this last point?
[Jason, As a user, I would have been happy to find
such directions in the README file, at least as
a suggested example. Of course, it's up to you.]
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/