Re: serverlog rotation/functions - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: serverlog rotation/functions
Date
Msg-id 200407161353.i6GDr8x01031@candle.pha.pa.us
Whole thread Raw
In response to Re: serverlog rotation/functions  (Andreas Pflug <pgadmin@pse-consulting.de>)
Responses Re: serverlog rotation/functions  (Andreas Pflug <pgadmin@pse-consulting.de>)
List pgsql-hackers
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@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: "Magnus Hagander"
Date:
Subject: Re: [pgsql-hackers-win32] Weird new time zone
Next
From: Tom Lane
Date:
Subject: Re: XLogWrite: write request 0/53A4000 is past end of log