Thread: Re: [PORTS] Logging (was Re: [GENERAL] PostgreSQL 7.0-2 RPMset released.)
Re: [PORTS] Logging (was Re: [GENERAL] PostgreSQL 7.0-2 RPMset released.)
From
Peter Eisentraut
Date:
Palle Girgensohn writes: > > > The real problem with redirecting the postmaster output is the issue > > > of log rolling, > I really enjoy using apache's rotatelogs program. stderr is > redirected through a pipe to a very small and robust C program, > rotatelogs, that takes as arguments number of seconds between > log rotates and the log filename. Logs are rotated every > argv[2] seconds. The rotatelogs program takes care of closing > and reopening, and nothing has to done from the application, > just start postmaster with '2>&1 | rotatelogs ...' at the end, > and log to stderr. Now there's a good idea. Why don't we abduct that program and teach pg_ctl about it. (After all, we abducted that one as well. :) -- Peter Eisentraut Sernanders väg 10:115 peter_e@gmx.net 75262 Uppsala http://yi.org/peter-e/ Sweden
Re: [PORTS] Logging (was Re: [GENERAL] PostgreSQL 7.0-2 RPMset released.)
From
"Roderick A. Anderson"
Date:
On Mon, 22 May 2000, Peter Eisentraut wrote: > Now there's a good idea. Why don't we abduct that program and teach pg_ctl > about it. (After all, we abducted that one as well. :) Imitation is the sincerest form of flattery. Not to mention this is the bazar. Rod -- Roderick A. Anderson raanders@altoplanos.net Altoplanos Information Systems, Inc. Voice: 208.765.6149 212 S. 11th Street, Suite 5 FAX: 208.664.5299 Coeur d'Alene, ID 83814
Re: [PORTS] Logging (was Re: [GENERAL] PostgreSQL 7.0-2 RPMset released.)
From
Palle Girgensohn
Date:
Hi, Glad to hear you like the idea. May I also suggest my favourite patch for rotatelogs (enclosed). It creates a "hard link" to the latest log using the base logfilename. i.e: -rw-r--r-- 1 root wheel 8901 May 19 04:45 localhost-access.log.0958694400 -rw-r--r-- 2 root wheel 18430 May 21 17:05 localhost-access.log.0958867200 -rw-r--r-- 2 root wheel 18430 May 21 17:05 localhost-access.log This is very nice when developing and debugging, since you don't need to check for the latest log's filename, but can just issue "tail -f localhost-access.log". FreeBSD'er can enjoy tail -F, which will follow the log even after a rotation... The function should probably be optional? Cheers, Palle "Roderick A. Anderson" wrote: > > On Mon, 22 May 2000, Peter Eisentraut wrote: > > > Now there's a good idea. Why don't we abduct that program and teach pg_ctl > > about it. (After all, we abducted that one as well. :) > > Imitation is the sincerest form of flattery. Not to mention this is the > bazar. > > Rod > -- > Roderick A. Anderson > raanders@altoplanos.net Altoplanos Information Systems, Inc. > Voice: 208.765.6149 212 S. 11th Street, Suite 5 > FAX: 208.664.5299 Coeur d'Alene, ID 83814 -- Palle--- src/support/rotatelogs.c~ Mon Aug 3 11:15:33 1998 +++ src/support/rotatelogs.c Sun Mar 26 22:42:40 2000 @@ -14,6 +14,7 @@ #include <time.h> #include <errno.h> #include <fcntl.h> +#include <unistd.h> int main (int argc, char **argv) { @@ -73,6 +74,8 @@ perror(buf2); exit(2); } + unlink(szLogRoot); + link(buf2, szLogRoot); } if (write(nLogFD, buf, nRead) != nRead) { perror(buf2);