Re: Log rotation

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: Log rotation
Дата
Msg-id 40535D3A.8040407@dunslane.net
обсуждение исходный текст
Ответ на Re: Log rotation  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Log rotation  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers

Tom Lane wrote:

>Andrew Dunstan <andrew@dunslane.net> 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



[andrew@alphonso 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
[andrew@alphonso apache_logging]$ rm rotatelogs
[andrew@alphonso apache_logging]$ rm rotatelogs.o
[andrew@alphonso 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
[andrew@alphonso apache_logging]$ ldd rotatelogs       libc.so.6 => /lib/tls/libc.so.6 (0x0065e000)
/lib/ld-linux.so.2=> /lib/ld-linux.so.2 (0x0056a000)
 
[andrew@alphonso 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>
[andrew@alphonso 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:=
[andrew@alphonso apache_logging]$



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Lamar Owen
Дата:
Сообщение: Re: Log rotation
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Log rotation