Re: serverlog rotation/functions

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: serverlog rotation/functions
Date: 2004-07-16 13:53:08
Message-ID: 200407161353.i6GDr8x01031@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Andreas Pflug wrote:
> > OK, it would be nice if we could do a sed operation like:
> >
> > sed 's/%./*/g'
> >
> > but I don't know a way to do that without defining a function or pulling
> > in a procedural language, but if we could do it we could do:
> >
> > pg_dir(echo log_destination | sed 's/%./*/g')
> >
>
> Argggg.... ever used sed on win32?!? And how should the timestamp be
> represented in client tools? Date/time interpretation is always a source
> of problems, so *please* let the server do that.

I am thinking of these all being server-side functions.

> Rethinking all this, I'd like the pg_logfile_list to return a complex type:
>
> CREATE TYPE pg_logfile_list AS (
> filedate timestamp,
> filename text,
> backendpid int,
> inuse bool)
>
> and
>
> pg_logfile_list() RETURNS SETOF pg_logfile_list
>
> which would enable
>
> SELECT filename,
> pg_file_unlink(filename)
> FROM pg_logfile_list()
> WHERE filedate < current_timestamp - '3 months'::interval
> AND NOT inuse
>
> In-use check is easy for the backend, if the syslog process publishes
> the current logfile's timestamp in sharedmem.
>
> We can use a GUC variable for the log_directory (not log_destination);
> anyway, I'd like the filenames to be selected by the server.

This seems quite involved. Can we get the basic functionality I
described first? Also I am not sure how all this information is going
to be passed from the logging process to the backend requesting the
information, and it seems overly complicated.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-07-16 13:58:56 Re: XLogWrite: write request 0/53A4000 is past end of log
Previous Message Magnus Hagander 2004-07-16 13:42:50 Re: [pgsql-hackers-win32] Weird new time zone

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2004-07-16 14:10:58 Re: [subxact] Proof-of-concept: report nest level to client
Previous Message Tom Lane 2004-07-16 13:29:53 Re: serverlog rotation/functions