Re: Feature proposal: distinguish each PostgreSQL instance in the event log

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: MauMau <maumau307(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Feature proposal: distinguish each PostgreSQL instance in the event log
Date: 2011-03-22 12:39:21
Message-ID: 4D889879.3080705@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 03/22/2011 08:22 AM, MauMau wrote:
> Hello,
>
> I have several software products which use PostgreSQL as a data
> repository and embed the same PostgreSQL binaries. Currently, those
> software support Linux. I'm trying to port them to Windows.
>
> I've encountered one problem on Windows. I need to support running all
> of my products on one host simultaneously. Plus, I need to log
> messages in syslog/event log. On Linux, I can distinguish the messages
> of one product and those of other products by setting syslog_ident in
> postgresql.conf. On the other hand, I can't do that on Windows: all of
> the PostgreSQL instances use the same fixed event source name
> "PostgreSQL".
>
> SO I'd like to propose a trivial feature which allows users to set
> event source. As I'm a newbie and this is my first proposal, I might
> behave inappropriately in the development process. Please point out if
> you notice I should act better. I've read the following site.
>
> Development information
> http://wiki.postgresql.org/wiki/Developer_and_Contributor_Resources
>
>
> Functional specification
> ========================================
>
> [Current usage]
> To enable event logging:
> 1. Register the event source "PostgreSQL" with the registry:
> c:\> regsvr32.exe <path of pgevent.dll>
> 2. Add 'eventlog' to log_destination parameter.
>
> To disable event logging:
> 1. Remove 'eventlog' from log_destination parameter.
> 2. Deregister the event source "PostgreSQL" from the registry.
> c:\> regsvr32.exe /u <path of pgevent.dll>
>
> [New usage]
> To use the default event source "PostgreSQL", the usage is the same as
> now. To use other event sources, add a bit of information.
>
> To enable event logging:
> 1. Register the event source with the registry:
> c:\> regsvr32.exe /i:<event source> <path of pgevent.dll>
> ex. To register "MyApp" event source:
> c:\> regsvr32.exe /i:"MyApp" pgevent.dll
> 2. Add 'eventlog' to log_destination parameter.
> 3. Name the event source with the new "event_source" parameter of
> postgresql.conf.
> ex.
> event_source = 'MyApp'
>
> To disable event logging:
> 1. Remove event_source parameter.
> 2. Remove 'eventlog' from log_destination parameter.
> 3. Deregister the event source from the registry.
> c:\> regsvr32.exe /u /i:<event source> <path of pgevent.dll>
> ex. To deregister "MyApp" event source:
> c:\> regsvr32.exe /u /i:"MyApp" pgevent.dll
>
>
> <<Considerations>>
> Is it better to have one parameter for syslog program name and event
> source, instead of having both syslog_ident and event_source?
> If it is, what name is good for the parameter? How about "program_name"?
> ex.
> program_name = 'MyApp'
> In this case, the traditional syslog_ident parameter is kept as an
> alias for backward compatibility, like the relationship between
> work_mem and sort_mem.
>
> If we have syslog_ident and event_source parameters separately, we
> will probably end up in having similar functions as follows:
> guc.c: assign_syslog_ident() and assign_event_source()
> elog.c: set_syslog_parameters() and set_eventlog_parameters()
>
> Does the community prefer separate parameters for each purpose (syslog
> and event log) at the expense of a bit duplicate code, or one unified
> parameter (program_name) with less code?
>
> I would appreciate your opinions and advice. I'll try making the patch
> while I'm waiting for response. I would be very much pleased if I
> could contribute to PostgreSQL and my proposal could be included in 9.1.
>
>

It's a good idea, but 9.1 has been closed for new features for some
time. This would have to wait for 9.2 I believe.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message MauMau 2011-03-22 14:08:42 Re: Feature proposal: distinguish each PostgreSQL instance in the event log
Previous Message MauMau 2011-03-22 12:22:21 Feature proposal: distinguish each PostgreSQL instance in the event log