Tom Lane wrote:

Andrew Dunstan <[EMAIL PROTECTED]> writes:


Did anything ever come from this thread? http://archives.postgresql.org/pgsql-hackers/2003-05/msg00603.php (Heading: "Plan B for log rotation support: borrow Apache code")



Only an entry on my depressingly long personal to-do list :-(


I did take a look at the Apache rotator program, and found that it was
probably more trouble to adopt than it's worth.  It seemed to depend on
a lot of configuration and library-routine infrastructure that we don't
share.  (No big surprise; I suppose someone trying to pull out a random
bit of our backend code would be at least as unhappy.)  I suspect it
would be less trouble, as well as legalistically cleaner, to write our
own from scratch.

Andrew Sullivan offered Afilias' rotator script awhile back also.
I think that works fine if you like a Perl script.




FWIW, in less than 30 minutes I took the log rotator from apache 1.3.29 (i.e. the latest non-APR version) and imported it into a fresh postgreql tree. With very little massaging it built happily (see below).


If it will advance matters, I can submit this as a patch filling the currently empty contrib/apache_logging directory. You could be right about the legal stuff - worth talking to the apache folks?

cheers

andrew



[EMAIL PROTECTED] apache_logging]$ make gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes -Wmissing-declarations rotatelogs.o -L../../src/port -Wl,-rpath,/home/andrew/tpg/inst//lib -o rotatelogs
[EMAIL PROTECTED] apache_logging]$ rm rotatelogs
[EMAIL PROTECTED] apache_logging]$ rm rotatelogs.o
[EMAIL PROTECTED] apache_logging]$ make
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes -Wmissing-declarations -I. -I../../src/include -D_GNU_SOURCE -c -o rotatelogs.o rotatelogs.c -MMD
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes -Wmissing-declarations rotatelogs.o -L../../src/port -Wl,-rpath,/home/andrew/tpg/inst//lib -o rotatelogs
[EMAIL PROTECTED] apache_logging]$ ldd rotatelogs
libc.so.6 => /lib/tls/libc.so.6 (0x0065e000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x0056a000)
[EMAIL PROTECTED] apache_logging]$ diff -cw ~/apache_1.3.29/src/support/rotatelogs.c rotatelogs.c
*** /home/andrew/apache_1.3.29/src/support/rotatelogs.c Mon Jul 14 14:31:26 2003
--- rotatelogs.c Sat Mar 13 13:47:41 2004
***************
*** 7,16 ****
*/



! #include "ap_config.h" #include <time.h> #include <errno.h> #include <fcntl.h>

 #if defined(WIN32) || defined(OS2)
 #include <io.h>
--- 7,18 ----
  */


! #include "postgres.h" #include <time.h> #include <errno.h> #include <fcntl.h> + #include <unistd.h> + #include <sys/types.h>

 #if defined(WIN32) || defined(OS2)
 #include <io.h>
[EMAIL PROTECTED] apache_logging]$ cat Makefile
# $PostgreSQL$

subdir = contrib/apache_logging
top_builddir = ../..
include $(top_builddir)/src/Makefile.global

PROGRAM = rotatelogs
OBJS    = rotatelogs.o


include $(top_srcdir)/contrib/contrib-global.mk


#LIBS:=$(filter-out -lpgport, $(LIBS))
LIBS:=
[EMAIL PROTECTED] apache_logging]$


---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly

Reply via email to