Re: Feature proposal: distinguish each PostgreSQL instance in the event log - Mailing list pgsql-hackers

From MauMau
Subject Re: Feature proposal: distinguish each PostgreSQL instance in the event log
Date
Msg-id C0955EADC88F4488B3427254D25EBDDC@maumau
Whole thread Raw
In response to Re: Feature proposal: distinguish each PostgreSQL instance in the event log  (Dave Page <dpage@pgadmin.org>)
List pgsql-hackers
From: "Dave Page" <dpage@pgadmin.org>
> On Tue, May 10, 2011 at 11:55 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> BTW, what will this accomplish exactly that couldn't be accomplished by
>> setting log_line_prefix to include the desired identifier?
>
> Windows uses the event source field to show where events in the logs
> have come from. The Event Viewer and other network management tools
> expect to be able to use the field for sorting and filtering etc, so
> having a different value for different PG instances allows those tools
> to distinguish between them properly. It's also useful for ISVs who
> may want to make an embedded PG instance used by their apps identify
> itself differently from other instances.

Thank you for help, Dave.

The Windows Event Viewer can filter event log records with event source, 
computer, user, date/time, etc. but not with message body. So 
log_line_prefix cannot be used for filtering. Even if filtering with message 
body were possible, using event source field to filter applications is more 
natural and intuitive.

I would appreciate comments from all on the following items mentioned 
previously. If no comments, I'll do as follows and try to submit the patch a 
week later or so if I have enough time.

1. Documentation
Move the event log registration/deregistion article to the following 
section. Add a link to this article from log_destination description.

16.1.4. Cleaning and installing
http://www.postgresql.org/docs/9.0/static/install-windows-full.html

2. pg_ctl's event logging
Do not change anything - that is, use the fixed event source "PostgreSQL".
How do we explain the reason for not using event_source parameter in 
postgresql.conf? "postgresql.conf is for the server. pg_ctl uses the fixed 
event source. This is a specification. This is not a problem because 
starting/stopping the database/application is infrequent once the system is 
in steady operation." -- this may sound abrupt, though.

Regards,
MauMau

----- Original Message ----- 
From: "Dave Page" <dpage@pgadmin.org>
To: "Tom Lane" <tgl@sss.pgh.pa.us>
Cc: "MauMau" <maumau307@gmail.com>; <pgsql-hackers@postgresql.org>
Sent: Wednesday, May 11, 2011 4:58 PM
Subject: Re: [HACKERS] Feature proposal: distinguish each PostgreSQL 
instance in the event log


> On Tue, May 10, 2011 at 11:55 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> "MauMau" <maumau307@gmail.com> writes:
>>>> "MauMau" <maumau307@gmail.com> writes:
>>>>> 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.
>>
>> BTW, what will this accomplish exactly that couldn't be accomplished by
>> setting log_line_prefix to include the desired identifier?
>
> Windows uses the event source field to show where events in the logs
> have come from. The Event Viewer and other network management tools
> expect to be able to use the field for sorting and filtering etc, so
> having a different value for different PG instances allows those tools
> to distinguish between them properly. It's also useful for ISVs who
> may want to make an embedded PG instance used by their apps identify
> itself differently from other instances.
>
>
> -- 
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
> 



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: the big picture for index-only scans
Next
From: Heikki Linnakangas
Date:
Subject: Re: time-delayed standbys