pgsql: Support configurable eventlog application names on Windows

Started by Magnus Haganderover 14 years ago6 messagescomitters
Jump to latest
#1Magnus Hagander
magnus@hagander.net

Support configurable eventlog application names on Windows

This allows different instances to use the eventlog with different
identifiers, by setting the event_source GUC, similar to how
syslog_ident works.

Original patch by MauMau, heavily modified by Magnus Hagander

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/d8ea33f2c02721c89c2434b9fda170afb7fe4999

Modified Files
--------------
doc/src/sgml/config.sgml | 25 +++++++++++
doc/src/sgml/installation.sgml | 13 ------
doc/src/sgml/runtime.sgml | 46 +++++++++++++++++++
src/backend/utils/error/elog.c | 3 +-
src/backend/utils/misc/guc.c | 14 ++++++
src/backend/utils/misc/postgresql.conf.sample | 2 +
src/bin/pgevent/pgevent.c | 58 ++++++++++++++++++++++--
src/bin/pgevent/pgevent.def | 1 +
8 files changed, 143 insertions(+), 19 deletions(-)

#2Jaime Casanova
jcasanov@systemguards.com.ec
In reply to: Magnus Hagander (#1)
Re: pgsql: Support configurable eventlog application names on Windows

On Tue, Oct 25, 2011 at 1:05 PM, Magnus Hagander <magnus@hagander.net> wrote:

Support configurable eventlog application names on Windows

This allows different instances to use the eventlog with different
identifiers, by setting the event_source GUC, similar to how
syslog_ident works.

if i uncomment event_source in a linux env i get this error:
"""
LOG: unrecognized configuration parameter "event_source" in file
"/usr/local/pgsql/9.2/data/postgresql.conf" line 326
FATAL: configuration file "/usr/local/pgsql/9.2/data/postgresql.conf"
contains errors
"""

this is because the definition of the GUC is inside an #ifdef, but the
error message is not very informative...
so, i tried to add a check_event_source (attached) and the error now
looks like this

"""
LOG: 22023: event_source can only be setted in windows builds
LOCATION: call_string_check_hook, guc.c:8172
FATAL: XX000: failed to initialize event_source to "PostgreSQL"
LOCATION: InitializeOneGUCOption, guc.c:3959
"""

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación

Attachments:

check_event_source.patchtext/x-patch; charset=US-ASCII; name=check_event_source.patchDownload+13-4
#3Magnus Hagander
magnus@hagander.net
In reply to: Jaime Casanova (#2)
Re: pgsql: Support configurable eventlog application names on Windows

On Tue, Oct 25, 2011 at 22:21, Jaime Casanova <jaime@2ndquadrant.com> wrote:

On Tue, Oct 25, 2011 at 1:05 PM, Magnus Hagander <magnus@hagander.net> wrote:

Support configurable eventlog application names on Windows

This allows different instances to use the eventlog with different
identifiers, by setting the event_source GUC, similar to how
syslog_ident works.

if i uncomment event_source in a linux env i get this error:
"""
LOG:  unrecognized configuration parameter "event_source" in file
"/usr/local/pgsql/9.2/data/postgresql.conf" line 326
FATAL:  configuration file "/usr/local/pgsql/9.2/data/postgresql.conf"
contains errors
"""

this is because the definition of the GUC is inside an #ifdef, but the
error message is not very informative...
so, i tried to add a check_event_source (attached) and the error now
looks like this

"""
LOG:  22023: event_source can only be setted in windows builds
LOCATION:  call_string_check_hook, guc.c:8172
FATAL:  XX000: failed to initialize event_source to "PostgreSQL"
LOCATION:  InitializeOneGUCOption, guc.c:3959
"""

Ugh, you are right. I thought I had fixed that, but it seems not. Will fix.

I think the proper fix is to just remove the #ifdef though. There's
precedent with e.g. syslog_ident, that we just ignore the setting if
it's not supported on that platform.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

#4Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Magnus Hagander (#1)
Re: pgsql: Support configurable eventlog application names on Windows

On 25.10.2011 21:05, Magnus Hagander wrote:

Support configurable eventlog application names on Windows

This allows different instances to use the eventlog with different
identifiers, by setting the event_source GUC, similar to how
syslog_ident works.

Original patch by MauMau, heavily modified by Magnus Hagander

Looks like the MinGw build didn't like this. Per frogmouth:

pgevent.o: In function `DllInstall':
c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.3916/../pgsql/src/bin/pgevent/pgevent.c:48:
undefined reference to `wcstombs_s'

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#1)
Re: pgsql: Support configurable eventlog application names on Windows

Magnus Hagander <magnus@hagander.net> writes:

Support configurable eventlog application names on Windows

Some of the buildfarm members still don't like this patch ...

regards, tom lane

#6Magnus Hagander
magnus@hagander.net
In reply to: Heikki Linnakangas (#4)
Re: pgsql: Support configurable eventlog application names on Windows

On Wed, Oct 26, 2011 at 16:41, Heikki Linnakangas
<heikki.linnakangas@enterprisedb.com> wrote:

On 25.10.2011 21:05, Magnus Hagander wrote:

Support configurable eventlog application names on Windows

This allows different instances to use the eventlog with different
identifiers, by setting the event_source GUC, similar to how
syslog_ident works.

Original patch by MauMau, heavily modified by Magnus Hagander

Looks like the MinGw build didn't like this. Per frogmouth:

pgevent.o: In function `DllInstall':
c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.3916/../pgsql/src/bin/pgevent/pgevent.c:48:
undefined reference to `wcstombs_s'

Ugh. Seems MingW doesn't support this basic API, which seems to have
been added in Windows 95..

Will fix.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/