Re: [PATCHES] serverlog rotation/functions

From: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [PATCHES] serverlog rotation/functions
Date: 2004-07-15 08:04:46
Message-ID: 40F63A9E.2070905@pse-consulting.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Bruce Momjian wrote:
> 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.
>

OK, next round.

> 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.

If logfiles are located using directory listings, this would mean we
should have well-known filename patterns instead of the current template
stuff. So only the serverlog directory name would be selectable, if that
makes still sense (I'd opt to drop that).

> 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.)

We'd better have distinct functions. The current is for reading large
chunks of data without interpretation of contents, and dir listing might
need tweaking for win32.
Now I wonder if it's better to have generic superuser-only functions for
list/read/write/delete (this would enable client-side editing of
postgresql.conf), or tie the functions to logfiles only (in which case
the logfile functions shouldn't use filenames but logfile timestamps).

I still believe the log process should write the current logfile
filename to shared-mem (write-only), so backends can prevent deleting it.

>
> 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

I'll start on the log process.

Regards,
Andreas

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gaetano Mendola 2004-07-15 09:45:17 Re: Release planning
Previous Message Simon Riggs 2004-07-15 07:45:47 Re: Point in Time Recovery

Browse pgsql-patches by date

  From Date Subject
Next Message Claudio Natoli 2004-07-15 08:08:35 pg_ctl --help
Previous Message Simon Riggs 2004-07-15 07:15:03 Re: [HACKERS] Point in Time Recovery