For adminstrator's convenience, I'd like to see a function that returns 
the serverlog.
Are there any security or other issues that should prevent me from 
implementing this?

Regards,
Andreas



Mon, 07 Jun 2004 02:01:18 +0200
Andreas Pflug <pgadmin@pse-consulting.de>
serverlog function
Andreas Pflug <pgadmin@pse-consulting.de> writes:
> For adminstrator's convenience, I'd like to see a function that returns 
> the serverlog.

What do you mean by "returns the serverlog"?  Are you going to magically
recover data that has gone to stderr or the syslogd daemon?  If so, how?
And why wouldn't you just go and look at the log file, instead?

			regards, tom lane

Sun, 06 Jun 2004 20:32:52 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: serverlog function 
Tom Lane wrote:

>Andreas Pflug <pgadmin@pse-consulting.de> writes:
>  
>
>>For adminstrator's convenience, I'd like to see a function that returns 
>>the serverlog.
>>    
>>
>
>What do you mean by "returns the serverlog"?  Are you going to magically
>recover data that has gone to stderr or the syslogd daemon?  If so, how?
>And why wouldn't you just go and look at the log file, instead?
>  
>

I'd like to see the serverlog even if I can't "go and look at the log 
file", because I don't have file access to the server.

Regards,
Andreas





Mon, 07 Jun 2004 11:23:49 +0200
Andreas Pflug <pgadmin@pse-consulting.de>
Re: serverlog function
Andreas Pflug wrote:

> Tom Lane wrote:
>
>> Andreas Pflug <pgadmin@pse-consulting.de> writes:
>>  
>>
>>> For adminstrator's convenience, I'd like to see a function that 
>>> returns the serverlog.
>>>   
>>
>>
>> What do you mean by "returns the serverlog"?  Are you going to magically
>> recover data that has gone to stderr or the syslogd daemon?  
>

Hm, what I missed is that pg_ctl's -l parameter converts to a simple 
stderr redirection, and it's hardly possible to find out where it's going.
This could be solved by a file log_destination option or a 
freopen(...,stderr) from a guc variable.

Regards,
Andreas


Mon, 07 Jun 2004 13:03:15 +0200
Andreas Pflug <pgadmin@pse-consulting.de>
Re: serverlog function (log_destination file)
Andreas Pflug <pgadmin@pse-consulting.de> writes:
> Hm, what I missed is that pg_ctl's -l parameter converts to a simple 
> stderr redirection, and it's hardly possible to find out where it's going.
> This could be solved by a file log_destination option or a 
> freopen(...,stderr) from a guc variable.

Any such patch would be rejected, because it would break the ability
to pipe stderr into another program (such as logrotate).  And what of
the syslog case?

			regards, tom lane

Mon, 07 Jun 2004 09:30:03 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: serverlog function (log_destination file) 
Andreas Pflug wrote:
> Tom Lane wrote:
> 
> >Andreas Pflug <pgadmin@pse-consulting.de> writes:
> >  
> >
> >>For adminstrator's convenience, I'd like to see a function that returns 
> >>the serverlog.
> >>    
> >>
> >
> >What do you mean by "returns the serverlog"?  Are you going to magically
> >recover data that has gone to stderr or the syslogd daemon?  If so, how?
> >And why wouldn't you just go and look at the log file, instead?
> >  
> >
> 
> I'd like to see the serverlog even if I can't "go and look at the log 
> file", because I don't have file access to the server.

Understand.  Unfortunately, we don't allow such functionality. The only
solution I can think of is to use syslog and send the logs to a machine
where you do have access.

-- 
  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, Pennsylvania 19073

Mon, 7 Jun 2004 09:39:42 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: serverlog function
Tom Lane wrote:

>Andreas Pflug <pgadmin@pse-consulting.de> writes:
>  
>
>>Hm, what I missed is that pg_ctl's -l parameter converts to a simple 
>>stderr redirection, and it's hardly possible to find out where it's going.
>>This could be solved by a file log_destination option or a 
>>freopen(...,stderr) from a guc variable.
>>    
>>
>
>Any such patch would be rejected, because it would break the ability
>to pipe stderr into another program (such as logrotate).  And what of
>the syslog case?
>
>  
>


Might it be sensible to have pg_ctl write its log destination (if any) 
out to a file in the data dir? That plus the log_destination setting 
might provide enough info at least for some common cases.

cheers

andrew

Mon, 07 Jun 2004 09:48:46 -0400
Andrew Dunstan <andrew@dunslane.net>
Re: serverlog function (log_destination file)
Bruce Momjian wrote:

>Andreas Pflug wrote:
>  
>
>>>
>>>      
>>>
>>I'd like to see the serverlog even if I can't "go and look at the log 
>>file", because I don't have file access to the server.
>>    
>>
>
>Understand.  Unfortunately, we don't allow such functionality. The only
>solution I can think of is to use syslog and send the logs to a machine
>where you do have access.
>
>  
>
What I mean is not how to set up a log solution, but how to offer a 
convenient way for the windows spoiled admins who like to have a gui for 
all kind of stuff, and just wants to hit a button "show server log", 
regardless of server location and platform type. This is a request that 
was recommended for pgadmin3.

AFAICS, we have some alternatives:
- try to grab the currently created files/syslog/eventlog. Seems hard to 
do, because we'd depend on additional external tools.
- redirect stderr to a postgresql.conf known file. Disadvantage: breaks 
piping.
- maintain a sharedMem for the latest messages. Disadvantage: limited 
space, no access to older entries after postmaster restart.
- additional log_destination "file". Disadvantage: Yet Another File 
besides the redirected stderr, but this seems a minor problem.



Regards,
Andreas



Mon, 07 Jun 2004 16:06:53 +0200
Andreas Pflug <pgadmin@pse-consulting.de>
Re: serverlog function
On Mon, Jun 07, 2004 at 16:06:53 +0200,
  Andreas Pflug <pgadmin@pse-consulting.de> wrote:
> 
> AFAICS, we have some alternatives:

You could also pipe the logs to a program that writes them to a table
in the database. As long as the logging level wasn't set so high that
inserting the log entries was logged. This should be a fairly simple
program to write and could be provided to people that wanted to provide
this feature for their server.

Mon, 7 Jun 2004 09:34:59 -0500
Bruno Wolff III <bruno@wolff.to>
Re: serverlog function