Re: [PATCHES] 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>
Subject: Re: [PATCHES] serverlog rotation/functions
Date: 2004-07-15 04:08:24
Message-ID: 200407150408.i6F48O124203@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


OK, I talked to Tom about this patch and I understand the issues now.

I think the best solution will be to have the postmaster start a child
process that can read the guc variables and create a log file based on
it contents. The child would be responsible to create a new log file
every X seconds as specified in the postgresql.conf file.

Backends wishing to read the log file would call a function to list the
contents of a directory. We can do this by creating a generic backend
super-user-only function that can list the contents of any directory.
Then you would use an API to read a specific file, similar to the log
reading functions you already have. In fact, you could set up the API
so reading a directory would return a list of directory names so you
don't need a separate directory listing function. (Does your API return
file contents as one big text string or as lines. If you return it as
one big text string, the directory idea will not work and you will need
a separate function.)

So, we have:

o use pipe and dup to copy stdout and stderr to your
postmaster child
o new guc variables to specify log destination and rotation times
o a server-side function to force a log rotate
o API to list a directory and show file contents

With this functionality, you can have clients listing the log directory
and choosing the most recent log file or previous ones. You could even
configure it to remove old log files.

Both Tom and I believe this is a more generic and reliable solution.

---------------------------------------------------------------------------

Andreas Pflug wrote:
> Bruce Momjian wrote:
> >
> > Also there are no documenttion changes.
>
> Here are the missing docs, freshly created against cvs.
>
> Regards,
> Andreas
>

--
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-15 04:20:59 Re: Portals and nested transactions
Previous Message Alvaro Herrera 2004-07-15 02:46:41 Re: Portals and nested transactions

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2004-07-15 07:15:03 Re: [HACKERS] Point in Time Recovery
Previous Message Bruce Momjian 2004-07-15 03:55:29 Re: [COMMITTERS] pgsql-server: Have \dn+ show permissions and description