Re: rotatelogs integration in pg_ctl

Lists: pgsql-hackers
From: "Thomas Swan" <tswan(at)idigx(dot)com>
To: "Andrew Hammond" <ahammond(at)ca(dot)afilias(dot)info>
Cc: "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: rotatelogs integration in pg_ctl
Date: 2004-04-13 14:33:42
Message-ID: 51675.199.222.14.2.1081866822.squirrel@www.idigx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

<quote who="Andrew Hammond">
> Tom Lane wrote:
>> Andrew Hammond <ahammond(at)ca(dot)afilias(dot)info> writes:
>>>I've attached a patch for pg_ctl which integrates the Apache project's
rotatelogs for logging.
>> Why bother? You just pipe pg_ctl's output to rotatelogs and you're done.
>
> It's not difficult to do, once you know how and once you know that there
aren't any gotchas. However, the question comes up often enough it's
clear that not everybody knows how. This provides a simple, clean,
standardized way of using rotatelog. The patch is simple, low risk, and
limited impact. So, why not?
>

Is there a reason the postmasters cannot just close/reopen-recreate the
log file when a SIGHUP or other signal is issued like apache? This would
allow for almost any scheme for log rotation to be handled by the system
or third party like logrotate and removes any duplicate effort between
projects.

I know on most distributions /var/log is not world writeable, so renaming
and and opening a file as postgres will not succeed. If the log files
are put in, for example, /var/log/pgsql with pgsql being rwx by postgres,
then it will work. The current packaging may need to be redone if you
want to enable loggin by default (if only startup and shutdown messages)


From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Thomas Swan <tswan(at)idigx(dot)com>
Cc: Andrew Hammond <ahammond(at)ca(dot)afilias(dot)info>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: rotatelogs integration in pg_ctl
Date: 2004-04-13 15:02:57
Message-ID: 20040413150257.GA17026@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Apr 13, 2004 at 09:33:42 -0500,
Thomas Swan <tswan(at)idigx(dot)com> wrote:
>
> Is there a reason the postmasters cannot just close/reopen-recreate the
> log file when a SIGHUP or other signal is issued like apache? This would
> allow for almost any scheme for log rotation to be handled by the system
> or third party like logrotate and removes any duplicate effort between
> projects.

Wouldn't that break logs piped to a program?


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: tswan(at)idigx(dot)com, "Andrew Hammond" <ahammond(at)ca(dot)afilias(dot)info>
Cc: "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: rotatelogs integration in pg_ctl
Date: 2004-04-13 15:03:49
Message-ID: 200404131703.49692.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Thomas Swan wrote:
> Is there a reason the postmasters cannot just close/reopen-recreate
> the log file when a SIGHUP or other signal is issued like apache?

Yes, because there is no "log file". The postmaster writes to stdout or
stderr.


From: "Thomas Swan" <tswan(at)idigx(dot)com>
To: "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Cc: tswan(at)idigx(dot)com, "Andrew Hammond" <ahammond(at)ca(dot)afilias(dot)info>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: rotatelogs integration in pg_ctl
Date: 2004-04-13 18:23:38
Message-ID: 56951.199.222.14.2.1081880618.squirrel@www.idigx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

<quote who="Peter Eisentraut">
> Thomas Swan wrote:
>> Is there a reason the postmasters cannot just close/reopen-recreate
>> the log file when a SIGHUP or other signal is issued like apache?
>
> Yes, because there is no "log file". The postmaster writes to stdout or
> stderr.
>
>

Ok, my misunderstanding. stdout/stderr are redirected to a file on
startup. This is why when I move/rename the logfile I have to stop/start
postgresql to start appending to the empty file.

Would there be any interest in modifying postmaster to support native file
logging in addition to stderr and stdout output? Are there any terrible
drawbacks that you could foresee?


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: tswan(at)idigx(dot)com
Cc: "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: rotatelogs integration in pg_ctl
Date: 2004-04-13 18:43:00
Message-ID: 200404132043.00766.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Thomas Swan wrote:
> Would there be any interest in modifying postmaster to support native
> file logging in addition to stderr and stdout output? Are there any
> terrible drawbacks that you could foresee?

We have about 8 years of mailing list archives describing them.