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

From: "MauMau" <maumau307(at)gmail(dot)com>
To: "Dave Page" <dpage(at)pgadmin(dot)org>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Feature proposal: distinguish each PostgreSQL instance in the event log
Date: 2011-05-11 11:51:59
Message-ID: C0955EADC88F4488B3427254D25EBDDC@maumau
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From: "Dave Page" <dpage(at)pgadmin(dot)org>
> On Tue, May 10, 2011 at 11:55 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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(at)pgadmin(dot)org>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "MauMau" <maumau307(at)gmail(dot)com>; <pgsql-hackers(at)postgresql(dot)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(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> "MauMau" <maumau307(at)gmail(dot)com> writes:
>>>> "MauMau" <maumau307(at)gmail(dot)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
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2011-05-11 11:53:41 Re: time-delayed standbys
Previous Message Robert Haas 2011-05-11 11:50:45 Re: the big picture for index-only scans