Syslog Facility Patch
Here is a patch for allowing the syslog facility to be set.
Index: doc/src/sgml/runtime.sgml
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/runtime.sgml,v
retrieving revision 1.33
diff -c -r1.33 runtime.sgml
*** doc/src/sgml/runtime.sgml 2000/11/10 16:32:09 1.33
--- doc/src/sgml/runtime.sgml 2000/11/12 17:13:37
***************
*** 822,827 ****
--- 822,839 ----
</varlistentry>
<varlistentry>
+ <term>SYSLOG_FACILITY (<type>string</type>)</term>
+ <listitem>
+ <para>
+ If the SYSLOG option is set to 1 or greater, this option determines
+ the <application>syslog</application> facility used. You may choose
+ from LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
+ the default is LOCAL0
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>TRACE_NOTIFY (<type>boolean</type>)</term>
<listitem>
<para>
Index: src/backend/utils/error/elog.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/error/elog.c,v
retrieving revision 1.65
diff -c -r1.65 elog.c
*** src/backend/utils/error/elog.c 2000/10/30 06:48:36 1.65
--- src/backend/utils/error/elog.c 2000/11/12 17:13:39
***************
*** 58,63 ****
--- 58,64 ----
* ... in theory anyway
*/
int Use_syslog = 0;
+ char *Syslog_facility = "LOCAL0";
static void write_syslog(int level, const char *line);
***************
*** 620,625 ****
--- 621,627 ----
static bool openlog_done = false;
static unsigned long seq = 0;
+ static int syslog_fac = LOG_LOCAL0;
int len = strlen(line);
if (Use_syslog == 0)
***************
*** 627,633 ****
if (!openlog_done)
{
! openlog("postgres", LOG_PID | LOG_NDELAY, LOG_LOCAL0);
openlog_done = true;
}
--- 629,651 ----
if (!openlog_done)
{
! if (strcmp(Syslog_facility,"LOCAL0") == 0)
! syslog_fac = LOG_LOCAL0;
! if (strcmp(Syslog_facility,"LOCAL1") == 0)
! syslog_fac = LOG_LOCAL1;
! if (strcmp(Syslog_facility,"LOCAL2") == 0)
! syslog_fac = LOG_LOCAL2;
! if (strcmp(Syslog_facility,"LOCAL3") == 0)
! syslog_fac = LOG_LOCAL3;
! if (strcmp(Syslog_facility,"LOCAL4") == 0)
! syslog_fac = LOG_LOCAL4;
! if (strcmp(Syslog_facility,"LOCAL5") == 0)
! syslog_fac = LOG_LOCAL5;
! if (strcmp(Syslog_facility,"LOCAL6") == 0)
! syslog_fac = LOG_LOCAL6;
! if (strcmp(Syslog_facility,"LOCAL7") == 0)
! syslog_fac = LOG_LOCAL7;
! openlog("postgres", LOG_PID | LOG_NDELAY, syslog_fac);
openlog_done = true;
}
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.16
diff -c -r1.16 guc.c
*** src/backend/utils/misc/guc.c 2000/11/09 11:25:59 1.16
--- src/backend/utils/misc/guc.c 2000/11/12 17:13:39
***************
*** 39,44 ****
--- 39,45 ----
extern int CheckPointTimeout;
extern int XLOGbuffers;
extern int XLOG_DEBUG;
+ extern char * Syslog_facility;
/*
* Debugging options
***************
*** 303,308 ****
--- 304,312 ----
{"unix_socket_group", PGC_POSTMASTER, &Unix_socket_group,
"", NULL},
+ #ifdef ENABLE_SYSLOG
+ {"syslog_facility", PGC_SIGHUP, &Syslog_facility, "LOCAL0", NULL},
+ #endif
{NULL, 0, NULL, NULL, NULL}
};
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
Larry Rosenman writes:
Here is a patch for allowing the syslog facility to be set.
I think you want to check for invalid values, like "LOCAL37.5". The last
field in the ConfigNamesString structure (see below) allows you to set a
"parse hook", that is, a function that parses the input value and returns
true if it is okay. At least this is how it is supposed to work, I've
never actually tried it. :) Or maybe just make it an integer option?
*************** *** 303,308 **** --- 304,312 ----{"unix_socket_group", PGC_POSTMASTER, &Unix_socket_group, "", NULL}, + #ifdef ENABLE_SYSLOG + {"syslog_facility", PGC_SIGHUP, &Syslog_facility, "LOCAL0", NULL}, + #endif{NULL, 0, NULL, NULL, NULL}
};
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
OK, I don't like it (it just says "syntax error"), but here is an
improved version. I also switched to strcasecmp...
Index: doc/src/sgml/runtime.sgml
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/runtime.sgml,v
retrieving revision 1.33
diff -c -r1.33 runtime.sgml
*** doc/src/sgml/runtime.sgml 2000/11/10 16:32:09 1.33
--- doc/src/sgml/runtime.sgml 2000/11/12 19:59:10
***************
*** 822,827 ****
--- 822,839 ----
</varlistentry>
<varlistentry>
+ <term>SYSLOG_FACILITY (<type>string</type>)</term>
+ <listitem>
+ <para>
+ If the SYSLOG option is set to 1 or greater, this option determines
+ the <application>syslog</application> facility used. You may choose
+ from LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
+ the default is LOCAL0
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>TRACE_NOTIFY (<type>boolean</type>)</term>
<listitem>
<para>
Index: src/backend/utils/error/elog.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/error/elog.c,v
retrieving revision 1.65
diff -c -r1.65 elog.c
*** src/backend/utils/error/elog.c 2000/10/30 06:48:36 1.65
--- src/backend/utils/error/elog.c 2000/11/12 19:59:13
***************
*** 58,63 ****
--- 58,64 ----
* ... in theory anyway
*/
int Use_syslog = 0;
+ char *Syslog_facility = "LOCAL0";
static void write_syslog(int level, const char *line);
***************
*** 620,625 ****
--- 621,627 ----
static bool openlog_done = false;
static unsigned long seq = 0;
+ static int syslog_fac = LOG_LOCAL0;
int len = strlen(line);
if (Use_syslog == 0)
***************
*** 627,633 ****
if (!openlog_done)
{
! openlog("postgres", LOG_PID | LOG_NDELAY, LOG_LOCAL0);
openlog_done = true;
}
--- 629,651 ----
if (!openlog_done)
{
! if (strcasecmp(Syslog_facility,"LOCAL0") == 0)
! syslog_fac = LOG_LOCAL0;
! if (strcasecmp(Syslog_facility,"LOCAL1") == 0)
! syslog_fac = LOG_LOCAL1;
! if (strcasecmp(Syslog_facility,"LOCAL2") == 0)
! syslog_fac = LOG_LOCAL2;
! if (strcasecmp(Syslog_facility,"LOCAL3") == 0)
! syslog_fac = LOG_LOCAL3;
! if (strcasecmp(Syslog_facility,"LOCAL4") == 0)
! syslog_fac = LOG_LOCAL4;
! if (strcasecmp(Syslog_facility,"LOCAL5") == 0)
! syslog_fac = LOG_LOCAL5;
! if (strcasecmp(Syslog_facility,"LOCAL6") == 0)
! syslog_fac = LOG_LOCAL6;
! if (strcasecmp(Syslog_facility,"LOCAL7") == 0)
! syslog_fac = LOG_LOCAL7;
! openlog("postgres", LOG_PID | LOG_NDELAY, syslog_fac);
openlog_done = true;
}
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.16
diff -c -r1.16 guc.c
*** src/backend/utils/misc/guc.c 2000/11/09 11:25:59 1.16
--- src/backend/utils/misc/guc.c 2000/11/12 19:59:15
***************
*** 39,44 ****
--- 39,48 ----
extern int CheckPointTimeout;
extern int XLOGbuffers;
extern int XLOG_DEBUG;
+ #ifdef ENABLE_SYSLOG
+ extern char * Syslog_facility;
+ bool check_facility(const char *facility);
+ #endif
/*
* Debugging options
***************
*** 303,308 ****
--- 307,315 ----
{"unix_socket_group", PGC_POSTMASTER, &Unix_socket_group,
"", NULL},
+ #ifdef ENABLE_SYSLOG
+ {"syslog_facility", PGC_SIGHUP, &Syslog_facility, "LOCAL0", check_facility},
+ #endif
{NULL, 0, NULL, NULL, NULL}
};
***************
*** 807,809 ****
--- 814,832 ----
if (*cp == '-')
*cp = '_';
}
+ #ifdef ENABLE_SYSLOG
+ bool check_facility(const char *facility)
+ {
+ if (strcasecmp(facility,"LOCAL0") == 0) return true;
+ if (strcasecmp(facility,"LOCAL1") == 0) return true;
+ if (strcasecmp(facility,"LOCAL2") == 0) return true;
+ if (strcasecmp(facility,"LOCAL3") == 0) return true;
+ if (strcasecmp(facility,"LOCAL4") == 0) return true;
+ if (strcasecmp(facility,"LOCAL5") == 0) return true;
+ if (strcasecmp(facility,"LOCAL6") == 0) return true;
+ if (strcasecmp(facility,"LOCAL7") == 0) return true;
+ fprintf(stderr,"invalid syslog_facility %s\n",facility);
+ elog(FATAL,"invalid syslog_facility %s",facility);
+ return false;
+ }
+ #endif
* Peter Eisentraut <peter_e@gmx.net> [001112 12:18]:
Larry Rosenman writes:
Here is a patch for allowing the syslog facility to be set.
I think you want to check for invalid values, like "LOCAL37.5". The last
field in the ConfigNamesString structure (see below) allows you to set a
"parse hook", that is, a function that parses the input value and returns
true if it is okay. At least this is how it is supposed to work, I've
never actually tried it. :) Or maybe just make it an integer option?*************** *** 303,308 **** --- 304,312 ----{"unix_socket_group", PGC_POSTMASTER, &Unix_socket_group, "", NULL}, + #ifdef ENABLE_SYSLOG + {"syslog_facility", PGC_SIGHUP, &Syslog_facility, "LOCAL0", NULL}, + #endif{NULL, 0, NULL, NULL, NULL}
};--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
* Larry Rosenman <ler@lerctr.org> [001112 14:02]:
OK, I don't like it (it just says "syntax error"), but here is an
improved version. I also switched to strcasecmp...
In looking at this some more, it appears that *SOMETHING* is not
allowing messages from set_config_option() in
/src/backend/utils/misc/guc.c out WHEN WE ARE DEALING WITH syslog type
stuff and we are reading it from the postgresql.conf file. I'm not
sure how to deal with this.. I set syslog=2 then syslog_facility to
some invalid value, and all I get is the syntax error message, not the
"option rejects value" message.
Anyone got any ideas?
Oh, delete the elog() and fprintf() before you commit my patch (in
check_facility() in guc.c), please.
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
* Larry Rosenman <ler@lerctr.org> [001112 15:41]:
* Larry Rosenman <ler@lerctr.org> [001112 14:02]:
OK, I don't like it (it just says "syntax error"), but here is an
improved version. I also switched to strcasecmp...In looking at this some more, it appears that *SOMETHING* is not
allowing messages from set_config_option() in
/src/backend/utils/misc/guc.c out WHEN WE ARE DEALING WITH syslog type
stuff and we are reading it from the postgresql.conf file. I'm not
sure how to deal with this.. I set syslog=2 then syslog_facility to
some invalid value, and all I get is the syntax error message, not the
"option rejects value" message.Anyone got any ideas?
Oh, delete the elog() and fprintf() before you commit my patch (in
check_facility() in guc.c), please.
Oh, more, if I give an invalid value on the command line, we get the
right message out. So, it appears to be a conf file issue.
I'm no (f)lex guru, nor do I totally understand the startup stuff.
I feel the patch (modulo the killing of the elog() and fprintf() is
valuable. I think I am the first to use the string parse_hook, so
this is probably the first time we've had this issue.
Any help would be appreciated.
LER
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
Here is a cleaned up patch, without the elog() and fprintf(), and some
minor formatting fixups.
Index: doc/src/sgml/runtime.sgml
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/runtime.sgml,v
retrieving revision 1.33
diff -c -r1.33 runtime.sgml
*** doc/src/sgml/runtime.sgml 2000/11/10 16:32:09 1.33
--- doc/src/sgml/runtime.sgml 2000/11/12 23:02:17
***************
*** 822,827 ****
--- 822,839 ----
</varlistentry>
<varlistentry>
+ <term>SYSLOG_FACILITY (<type>string</type>)</term>
+ <listitem>
+ <para>
+ If the SYSLOG option is set to 1 or greater, this option determines
+ the <application>syslog</application> facility used. You may choose
+ from LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
+ the default is LOCAL0
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>TRACE_NOTIFY (<type>boolean</type>)</term>
<listitem>
<para>
Index: src/backend/utils/error/elog.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/error/elog.c,v
retrieving revision 1.65
diff -c -r1.65 elog.c
*** src/backend/utils/error/elog.c 2000/10/30 06:48:36 1.65
--- src/backend/utils/error/elog.c 2000/11/12 23:02:20
***************
*** 58,63 ****
--- 58,64 ----
* ... in theory anyway
*/
int Use_syslog = 0;
+ char *Syslog_facility = "LOCAL0";
static void write_syslog(int level, const char *line);
***************
*** 620,625 ****
--- 621,627 ----
static bool openlog_done = false;
static unsigned long seq = 0;
+ static int syslog_fac = LOG_LOCAL0;
int len = strlen(line);
if (Use_syslog == 0)
***************
*** 627,633 ****
if (!openlog_done)
{
! openlog("postgres", LOG_PID | LOG_NDELAY, LOG_LOCAL0);
openlog_done = true;
}
--- 629,651 ----
if (!openlog_done)
{
! if (strcasecmp(Syslog_facility,"LOCAL0") == 0)
! syslog_fac = LOG_LOCAL0;
! if (strcasecmp(Syslog_facility,"LOCAL1") == 0)
! syslog_fac = LOG_LOCAL1;
! if (strcasecmp(Syslog_facility,"LOCAL2") == 0)
! syslog_fac = LOG_LOCAL2;
! if (strcasecmp(Syslog_facility,"LOCAL3") == 0)
! syslog_fac = LOG_LOCAL3;
! if (strcasecmp(Syslog_facility,"LOCAL4") == 0)
! syslog_fac = LOG_LOCAL4;
! if (strcasecmp(Syslog_facility,"LOCAL5") == 0)
! syslog_fac = LOG_LOCAL5;
! if (strcasecmp(Syslog_facility,"LOCAL6") == 0)
! syslog_fac = LOG_LOCAL6;
! if (strcasecmp(Syslog_facility,"LOCAL7") == 0)
! syslog_fac = LOG_LOCAL7;
! openlog("postgres", LOG_PID | LOG_NDELAY, syslog_fac);
openlog_done = true;
}
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.16
diff -c -r1.16 guc.c
*** src/backend/utils/misc/guc.c 2000/11/09 11:25:59 1.16
--- src/backend/utils/misc/guc.c 2000/11/12 23:02:22
***************
*** 39,44 ****
--- 39,48 ----
extern int CheckPointTimeout;
extern int XLOGbuffers;
extern int XLOG_DEBUG;
+ #ifdef ENABLE_SYSLOG
+ extern char *Syslog_facility;
+ bool check_facility(const char *facility);
+ #endif
/*
* Debugging options
***************
*** 303,308 ****
--- 307,316 ----
{"unix_socket_group", PGC_POSTMASTER, &Unix_socket_group,
"", NULL},
+ #ifdef ENABLE_SYSLOG
+ {"syslog_facility", PGC_SIGHUP, &Syslog_facility,
+ "LOCAL0", check_facility},
+ #endif
{NULL, 0, NULL, NULL, NULL}
};
***************
*** 807,809 ****
--- 815,832 ----
if (*cp == '-')
*cp = '_';
}
+ #ifdef ENABLE_SYSLOG
+ bool
+ check_facility(const char *facility)
+ {
+ if (strcasecmp(facility,"LOCAL0") == 0) return true;
+ if (strcasecmp(facility,"LOCAL1") == 0) return true;
+ if (strcasecmp(facility,"LOCAL2") == 0) return true;
+ if (strcasecmp(facility,"LOCAL3") == 0) return true;
+ if (strcasecmp(facility,"LOCAL4") == 0) return true;
+ if (strcasecmp(facility,"LOCAL5") == 0) return true;
+ if (strcasecmp(facility,"LOCAL6") == 0) return true;
+ if (strcasecmp(facility,"LOCAL7") == 0) return true;
+ return false;
+ }
+ #endif
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
Ok, You guys are probably tired of me, BUT, here is another one, that
adds the facility to set the program name used in syslog.
(this includes the other ones).
One gotcha, the parser doesn't like special characters in strings.
For example, i tried to use pg-test, and if failed the parse coming
from the postgresql.conf file.
I don't think it's a showstopper..
Comments?
Index: doc/src/sgml/runtime.sgml
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/runtime.sgml,v
retrieving revision 1.33
diff -c -r1.33 runtime.sgml
*** doc/src/sgml/runtime.sgml 2000/11/10 16:32:09 1.33
--- doc/src/sgml/runtime.sgml 2000/11/13 01:15:34
***************
*** 822,827 ****
--- 822,851 ----
</varlistentry>
<varlistentry>
+ <term>SYSLOG_FACILITY (<type>string</type>)</term>
+ <listitem>
+ <para>
+ If the SYSLOG option is set to 1 or greater, this option determines
+ the <application>syslog</application> facility used. You may choose
+ from LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
+ the default is LOCAL0
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>SYSLOG_PROGID (<type>string</type>)</term>
+ <listitem>
+ <para>
+ If the SYSLOG option is set to 1 or greater, this option determines
+ the program id used to identify <product>PostgreSQL</product> messages
+ in <application>syslog</application> log messages. The default is
+ postgres.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>TRACE_NOTIFY (<type>boolean</type>)</term>
<listitem>
<para>
Index: src/backend/utils/error/elog.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/error/elog.c,v
retrieving revision 1.65
diff -c -r1.65 elog.c
*** src/backend/utils/error/elog.c 2000/10/30 06:48:36 1.65
--- src/backend/utils/error/elog.c 2000/11/13 01:15:37
***************
*** 58,63 ****
--- 58,65 ----
* ... in theory anyway
*/
int Use_syslog = 0;
+ char *Syslog_facility = "LOCAL0";
+ char *Syslog_progid = "postgres";
static void write_syslog(int level, const char *line);
***************
*** 620,625 ****
--- 622,628 ----
static bool openlog_done = false;
static unsigned long seq = 0;
+ static int syslog_fac = LOG_LOCAL0;
int len = strlen(line);
if (Use_syslog == 0)
***************
*** 627,633 ****
if (!openlog_done)
{
! openlog("postgres", LOG_PID | LOG_NDELAY, LOG_LOCAL0);
openlog_done = true;
}
--- 630,652 ----
if (!openlog_done)
{
! if (strcasecmp(Syslog_facility,"LOCAL0") == 0)
! syslog_fac = LOG_LOCAL0;
! if (strcasecmp(Syslog_facility,"LOCAL1") == 0)
! syslog_fac = LOG_LOCAL1;
! if (strcasecmp(Syslog_facility,"LOCAL2") == 0)
! syslog_fac = LOG_LOCAL2;
! if (strcasecmp(Syslog_facility,"LOCAL3") == 0)
! syslog_fac = LOG_LOCAL3;
! if (strcasecmp(Syslog_facility,"LOCAL4") == 0)
! syslog_fac = LOG_LOCAL4;
! if (strcasecmp(Syslog_facility,"LOCAL5") == 0)
! syslog_fac = LOG_LOCAL5;
! if (strcasecmp(Syslog_facility,"LOCAL6") == 0)
! syslog_fac = LOG_LOCAL6;
! if (strcasecmp(Syslog_facility,"LOCAL7") == 0)
! syslog_fac = LOG_LOCAL7;
! openlog(Syslog_progid, LOG_PID | LOG_NDELAY, syslog_fac);
openlog_done = true;
}
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.16
diff -c -r1.16 guc.c
*** src/backend/utils/misc/guc.c 2000/11/09 11:25:59 1.16
--- src/backend/utils/misc/guc.c 2000/11/13 01:15:38
***************
*** 39,44 ****
--- 39,49 ----
extern int CheckPointTimeout;
extern int XLOGbuffers;
extern int XLOG_DEBUG;
+ #ifdef ENABLE_SYSLOG
+ extern char *Syslog_facility;
+ extern char *Syslog_progid;
+ bool check_facility(const char *facility);
+ #endif
/*
* Debugging options
***************
*** 303,308 ****
--- 308,319 ----
{"unix_socket_group", PGC_POSTMASTER, &Unix_socket_group,
"", NULL},
+ #ifdef ENABLE_SYSLOG
+ {"syslog_facility", PGC_SIGHUP, &Syslog_facility,
+ "LOCAL0", check_facility},
+ {"syslog_progid", PGC_SIGHUP, &Syslog_progid,
+ "postgres", NULL},
+ #endif
{NULL, 0, NULL, NULL, NULL}
};
***************
*** 807,809 ****
--- 818,835 ----
if (*cp == '-')
*cp = '_';
}
+ #ifdef ENABLE_SYSLOG
+ bool
+ check_facility(const char *facility)
+ {
+ if (strcasecmp(facility,"LOCAL0") == 0) return true;
+ if (strcasecmp(facility,"LOCAL1") == 0) return true;
+ if (strcasecmp(facility,"LOCAL2") == 0) return true;
+ if (strcasecmp(facility,"LOCAL3") == 0) return true;
+ if (strcasecmp(facility,"LOCAL4") == 0) return true;
+ if (strcasecmp(facility,"LOCAL5") == 0) return true;
+ if (strcasecmp(facility,"LOCAL6") == 0) return true;
+ if (strcasecmp(facility,"LOCAL7") == 0) return true;
+ return false;
+ }
+ #endif
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
* Larry Rosenman <ler@lerctr.org> [001112 19:20]:
Ok, You guys are probably tired of me, BUT, here is another one, that
adds the facility to set the program name used in syslog.
(this includes the other ones).One gotcha, the parser doesn't like special characters in strings.
For example, i tried to use pg-test, and if failed the parse coming
from the postgresql.conf file.I don't think it's a showstopper..
Comments?
Any chance of this getting committed?
LER
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
Applied.
Ok, You guys are probably tired of me, BUT, here is another one, that
adds the facility to set the program name used in syslog.
(this includes the other ones).One gotcha, the parser doesn't like special characters in strings.
For example, i tried to use pg-test, and if failed the parse coming
from the postgresql.conf file.I don't think it's a showstopper..
Comments?
Index: doc/src/sgml/runtime.sgml =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/runtime.sgml,v retrieving revision 1.33 diff -c -r1.33 runtime.sgml *** doc/src/sgml/runtime.sgml 2000/11/10 16:32:09 1.33 --- doc/src/sgml/runtime.sgml 2000/11/13 01:15:34 *************** *** 822,827 **** --- 822,851 ---- </varlistentry><varlistentry> + <term>SYSLOG_FACILITY (<type>string</type>)</term> + <listitem> + <para> + If the SYSLOG option is set to 1 or greater, this option determines + the <application>syslog</application> facility used. You may choose + from LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. + the default is LOCAL0 + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>SYSLOG_PROGID (<type>string</type>)</term> + <listitem> + <para> + If the SYSLOG option is set to 1 or greater, this option determines + the program id used to identify <product>PostgreSQL</product> messages + in <application>syslog</application> log messages. The default is + postgres. + </para> + </listitem> + </varlistentry> + + <varlistentry> <term>TRACE_NOTIFY (<type>boolean</type>)</term> <listitem> <para> Index: src/backend/utils/error/elog.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/error/elog.c,v retrieving revision 1.65 diff -c -r1.65 elog.c *** src/backend/utils/error/elog.c 2000/10/30 06:48:36 1.65 --- src/backend/utils/error/elog.c 2000/11/13 01:15:37 *************** *** 58,63 **** --- 58,65 ---- * ... in theory anyway */ int Use_syslog = 0; + char *Syslog_facility = "LOCAL0"; + char *Syslog_progid = "postgres";static void write_syslog(int level, const char *line);
*************** *** 620,625 **** --- 622,628 ----static bool openlog_done = false;
static unsigned long seq = 0;
+ static int syslog_fac = LOG_LOCAL0;
int len = strlen(line);if (Use_syslog == 0)
***************
*** 627,633 ****if (!openlog_done)
{
! openlog("postgres", LOG_PID | LOG_NDELAY, LOG_LOCAL0);
openlog_done = true;
}--- 630,652 ----if (!openlog_done)
{
! if (strcasecmp(Syslog_facility,"LOCAL0") == 0)
! syslog_fac = LOG_LOCAL0;
! if (strcasecmp(Syslog_facility,"LOCAL1") == 0)
! syslog_fac = LOG_LOCAL1;
! if (strcasecmp(Syslog_facility,"LOCAL2") == 0)
! syslog_fac = LOG_LOCAL2;
! if (strcasecmp(Syslog_facility,"LOCAL3") == 0)
! syslog_fac = LOG_LOCAL3;
! if (strcasecmp(Syslog_facility,"LOCAL4") == 0)
! syslog_fac = LOG_LOCAL4;
! if (strcasecmp(Syslog_facility,"LOCAL5") == 0)
! syslog_fac = LOG_LOCAL5;
! if (strcasecmp(Syslog_facility,"LOCAL6") == 0)
! syslog_fac = LOG_LOCAL6;
! if (strcasecmp(Syslog_facility,"LOCAL7") == 0)
! syslog_fac = LOG_LOCAL7;
! openlog(Syslog_progid, LOG_PID | LOG_NDELAY, syslog_fac);
openlog_done = true;
}Index: src/backend/utils/misc/guc.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/misc/guc.c,v retrieving revision 1.16 diff -c -r1.16 guc.c *** src/backend/utils/misc/guc.c 2000/11/09 11:25:59 1.16 --- src/backend/utils/misc/guc.c 2000/11/13 01:15:38 *************** *** 39,44 **** --- 39,49 ---- extern int CheckPointTimeout; extern int XLOGbuffers; extern int XLOG_DEBUG; + #ifdef ENABLE_SYSLOG + extern char *Syslog_facility; + extern char *Syslog_progid; + bool check_facility(const char *facility); + #endif/* * Debugging options *************** *** 303,308 **** --- 308,319 ----{"unix_socket_group", PGC_POSTMASTER, &Unix_socket_group, "", NULL}, + #ifdef ENABLE_SYSLOG + {"syslog_facility", PGC_SIGHUP, &Syslog_facility, + "LOCAL0", check_facility}, + {"syslog_progid", PGC_SIGHUP, &Syslog_progid, + "postgres", NULL}, + #endif{NULL, 0, NULL, NULL, NULL} }; *************** *** 807,809 **** --- 818,835 ---- if (*cp == '-') *cp = '_'; } + #ifdef ENABLE_SYSLOG + bool + check_facility(const char *facility) + { + if (strcasecmp(facility,"LOCAL0") == 0) return true; + if (strcasecmp(facility,"LOCAL1") == 0) return true; + if (strcasecmp(facility,"LOCAL2") == 0) return true; + if (strcasecmp(facility,"LOCAL3") == 0) return true; + if (strcasecmp(facility,"LOCAL4") == 0) return true; + if (strcasecmp(facility,"LOCAL5") == 0) return true; + if (strcasecmp(facility,"LOCAL6") == 0) return true; + if (strcasecmp(facility,"LOCAL7") == 0) return true; + return false; + } + #endif -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
* Bruce Momjian <pgman@candle.pha.pa.us> [001113 15:36]:
Applied.
Thanks. FWIW, I had to pull the CVS copy of guc.c (my cvs update got
two copies of my updates to the table).
Comments on my postgresql.conf issues from the rest of the -hackers
corp?
Thanks!
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
* Peter Eisentraut <peter_e@gmx.net> [001113 17:41]:
Bruce Momjian writes:
Applied.
Uh, shouldn't the problems Larry pointed out be fixed first?
I don't think the problems are BECAUSE of my code. The new stuff
works, just putting the new options in postgresql.conf with a bad
value causes weird messages. I think the new code should stay, and
now we have stuff to figure out why guc-file.l or guc.c has a problem
getting the message out.
I requested the commit.
I think the issue is in guc-file.l or somewhere else in the startup of
a new backend to get the right error out.
I'm not familiar enough with the backend startup to debug these
wierdnesses(sp?).
LER
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
Import Notes
Reply to msg id not found: Pine.LNX.4.21.0011140045520.970-100000@peter.localdomain
There were problems? I saw someone asking why it hadn't been applied
yet. What do people want? I can back it out.
Bruce Momjian writes:
Applied.
Uh, shouldn't the problems Larry pointed out be fixed first?
Ok, You guys are probably tired of me, BUT, here is another one, that
adds the facility to set the program name used in syslog.
(this includes the other ones).One gotcha, the parser doesn't like special characters in strings.
For example, i tried to use pg-test, and if failed the parse coming
from the postgresql.conf file.I don't think it's a showstopper..
Comments?
Index: doc/src/sgml/runtime.sgml =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/runtime.sgml,v retrieving revision 1.33 diff -c -r1.33 runtime.sgml *** doc/src/sgml/runtime.sgml 2000/11/10 16:32:09 1.33 --- doc/src/sgml/runtime.sgml 2000/11/13 01:15:34 *************** *** 822,827 **** --- 822,851 ---- </varlistentry><varlistentry> + <term>SYSLOG_FACILITY (<type>string</type>)</term> + <listitem> + <para> + If the SYSLOG option is set to 1 or greater, this option determines + the <application>syslog</application> facility used. You may choose + from LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. + the default is LOCAL0 + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>SYSLOG_PROGID (<type>string</type>)</term> + <listitem> + <para> + If the SYSLOG option is set to 1 or greater, this option determines + the program id used to identify <product>PostgreSQL</product> messages + in <application>syslog</application> log messages. The default is + postgres. + </para> + </listitem> + </varlistentry> + + <varlistentry> <term>TRACE_NOTIFY (<type>boolean</type>)</term> <listitem> <para> Index: src/backend/utils/error/elog.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/error/elog.c,v retrieving revision 1.65 diff -c -r1.65 elog.c *** src/backend/utils/error/elog.c 2000/10/30 06:48:36 1.65 --- src/backend/utils/error/elog.c 2000/11/13 01:15:37 *************** *** 58,63 **** --- 58,65 ---- * ... in theory anyway */ int Use_syslog = 0; + char *Syslog_facility = "LOCAL0"; + char *Syslog_progid = "postgres";static void write_syslog(int level, const char *line);
*************** *** 620,625 **** --- 622,628 ----static bool openlog_done = false;
static unsigned long seq = 0;
+ static int syslog_fac = LOG_LOCAL0;
int len = strlen(line);if (Use_syslog == 0)
***************
*** 627,633 ****if (!openlog_done)
{
! openlog("postgres", LOG_PID | LOG_NDELAY, LOG_LOCAL0);
openlog_done = true;
}--- 630,652 ----if (!openlog_done)
{
! if (strcasecmp(Syslog_facility,"LOCAL0") == 0)
! syslog_fac = LOG_LOCAL0;
! if (strcasecmp(Syslog_facility,"LOCAL1") == 0)
! syslog_fac = LOG_LOCAL1;
! if (strcasecmp(Syslog_facility,"LOCAL2") == 0)
! syslog_fac = LOG_LOCAL2;
! if (strcasecmp(Syslog_facility,"LOCAL3") == 0)
! syslog_fac = LOG_LOCAL3;
! if (strcasecmp(Syslog_facility,"LOCAL4") == 0)
! syslog_fac = LOG_LOCAL4;
! if (strcasecmp(Syslog_facility,"LOCAL5") == 0)
! syslog_fac = LOG_LOCAL5;
! if (strcasecmp(Syslog_facility,"LOCAL6") == 0)
! syslog_fac = LOG_LOCAL6;
! if (strcasecmp(Syslog_facility,"LOCAL7") == 0)
! syslog_fac = LOG_LOCAL7;
! openlog(Syslog_progid, LOG_PID | LOG_NDELAY, syslog_fac);
openlog_done = true;
}Index: src/backend/utils/misc/guc.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/misc/guc.c,v retrieving revision 1.16 diff -c -r1.16 guc.c *** src/backend/utils/misc/guc.c 2000/11/09 11:25:59 1.16 --- src/backend/utils/misc/guc.c 2000/11/13 01:15:38 *************** *** 39,44 **** --- 39,49 ---- extern int CheckPointTimeout; extern int XLOGbuffers; extern int XLOG_DEBUG; + #ifdef ENABLE_SYSLOG + extern char *Syslog_facility; + extern char *Syslog_progid; + bool check_facility(const char *facility); + #endif/* * Debugging options *************** *** 303,308 **** --- 308,319 ----{"unix_socket_group", PGC_POSTMASTER, &Unix_socket_group, "", NULL}, + #ifdef ENABLE_SYSLOG + {"syslog_facility", PGC_SIGHUP, &Syslog_facility, + "LOCAL0", check_facility}, + {"syslog_progid", PGC_SIGHUP, &Syslog_progid, + "postgres", NULL}, + #endif{NULL, 0, NULL, NULL, NULL} }; *************** *** 807,809 **** --- 818,835 ---- if (*cp == '-') *cp = '_'; } + #ifdef ENABLE_SYSLOG + bool + check_facility(const char *facility) + { + if (strcasecmp(facility,"LOCAL0") == 0) return true; + if (strcasecmp(facility,"LOCAL1") == 0) return true; + if (strcasecmp(facility,"LOCAL2") == 0) return true; + if (strcasecmp(facility,"LOCAL3") == 0) return true; + if (strcasecmp(facility,"LOCAL4") == 0) return true; + if (strcasecmp(facility,"LOCAL5") == 0) return true; + if (strcasecmp(facility,"LOCAL6") == 0) return true; + if (strcasecmp(facility,"LOCAL7") == 0) return true; + return false; + } + #endif -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Import Notes
Reply to msg id not found: Pine.LNX.4.21.0011140045520.970-100000@peter.localdomain | Resolved by subject fallback
* Peter Eisentraut <peter_e@gmx.net> [001113 17:41]:
Bruce Momjian writes:
Applied.
Uh, shouldn't the problems Larry pointed out be fixed first?
I don't think the problems are BECAUSE of my code. The new stuff
works, just putting the new options in postgresql.conf with a bad
value causes weird messages. I think the new code should stay, and
now we have stuff to figure out why guc-file.l or guc.c has a problem
getting the message out.I requested the commit.
Man, I knew I saw that request somewhere. :-)
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
* Peter Eisentraut <peter_e@gmx.net> [001113 17:43]:
Larry Rosenman writes:
Ok, You guys are probably tired of me, BUT, here is another one, that
adds the facility to set the program name used in syslog.
(this includes the other ones).Why would one want to do that? ISTM that that would just be a means to
play games with the sysadmin.
test vs. production postgresDB's, virtual users (ala uunet), multiple
different pg's listening on different ports.
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
Import Notes
Reply to msg id not found: Pine.LNX.4.21.0011140047370.970-100000@peter.localdomain
Bruce Momjian writes:
Applied.
Uh, shouldn't the problems Larry pointed out be fixed first?
Ok, You guys are probably tired of me, BUT, here is another one, that
adds the facility to set the program name used in syslog.
(this includes the other ones).One gotcha, the parser doesn't like special characters in strings.
For example, i tried to use pg-test, and if failed the parse coming
from the postgresql.conf file.I don't think it's a showstopper..
Comments?
Index: doc/src/sgml/runtime.sgml =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/runtime.sgml,v retrieving revision 1.33 diff -c -r1.33 runtime.sgml *** doc/src/sgml/runtime.sgml 2000/11/10 16:32:09 1.33 --- doc/src/sgml/runtime.sgml 2000/11/13 01:15:34 *************** *** 822,827 **** --- 822,851 ---- </varlistentry><varlistentry> + <term>SYSLOG_FACILITY (<type>string</type>)</term> + <listitem> + <para> + If the SYSLOG option is set to 1 or greater, this option determines + the <application>syslog</application> facility used. You may choose + from LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. + the default is LOCAL0 + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>SYSLOG_PROGID (<type>string</type>)</term> + <listitem> + <para> + If the SYSLOG option is set to 1 or greater, this option determines + the program id used to identify <product>PostgreSQL</product> messages + in <application>syslog</application> log messages. The default is + postgres. + </para> + </listitem> + </varlistentry> + + <varlistentry> <term>TRACE_NOTIFY (<type>boolean</type>)</term> <listitem> <para> Index: src/backend/utils/error/elog.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/error/elog.c,v retrieving revision 1.65 diff -c -r1.65 elog.c *** src/backend/utils/error/elog.c 2000/10/30 06:48:36 1.65 --- src/backend/utils/error/elog.c 2000/11/13 01:15:37 *************** *** 58,63 **** --- 58,65 ---- * ... in theory anyway */ int Use_syslog = 0; + char *Syslog_facility = "LOCAL0"; + char *Syslog_progid = "postgres";static void write_syslog(int level, const char *line);
*************** *** 620,625 **** --- 622,628 ----static bool openlog_done = false;
static unsigned long seq = 0;
+ static int syslog_fac = LOG_LOCAL0;
int len = strlen(line);if (Use_syslog == 0)
***************
*** 627,633 ****if (!openlog_done)
{
! openlog("postgres", LOG_PID | LOG_NDELAY, LOG_LOCAL0);
openlog_done = true;
}--- 630,652 ----if (!openlog_done)
{
! if (strcasecmp(Syslog_facility,"LOCAL0") == 0)
! syslog_fac = LOG_LOCAL0;
! if (strcasecmp(Syslog_facility,"LOCAL1") == 0)
! syslog_fac = LOG_LOCAL1;
! if (strcasecmp(Syslog_facility,"LOCAL2") == 0)
! syslog_fac = LOG_LOCAL2;
! if (strcasecmp(Syslog_facility,"LOCAL3") == 0)
! syslog_fac = LOG_LOCAL3;
! if (strcasecmp(Syslog_facility,"LOCAL4") == 0)
! syslog_fac = LOG_LOCAL4;
! if (strcasecmp(Syslog_facility,"LOCAL5") == 0)
! syslog_fac = LOG_LOCAL5;
! if (strcasecmp(Syslog_facility,"LOCAL6") == 0)
! syslog_fac = LOG_LOCAL6;
! if (strcasecmp(Syslog_facility,"LOCAL7") == 0)
! syslog_fac = LOG_LOCAL7;
! openlog(Syslog_progid, LOG_PID | LOG_NDELAY, syslog_fac);
openlog_done = true;
}Index: src/backend/utils/misc/guc.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/misc/guc.c,v retrieving revision 1.16 diff -c -r1.16 guc.c *** src/backend/utils/misc/guc.c 2000/11/09 11:25:59 1.16 --- src/backend/utils/misc/guc.c 2000/11/13 01:15:38 *************** *** 39,44 **** --- 39,49 ---- extern int CheckPointTimeout; extern int XLOGbuffers; extern int XLOG_DEBUG; + #ifdef ENABLE_SYSLOG + extern char *Syslog_facility; + extern char *Syslog_progid; + bool check_facility(const char *facility); + #endif/* * Debugging options *************** *** 303,308 **** --- 308,319 ----{"unix_socket_group", PGC_POSTMASTER, &Unix_socket_group, "", NULL}, + #ifdef ENABLE_SYSLOG + {"syslog_facility", PGC_SIGHUP, &Syslog_facility, + "LOCAL0", check_facility}, + {"syslog_progid", PGC_SIGHUP, &Syslog_progid, + "postgres", NULL}, + #endif{NULL, 0, NULL, NULL, NULL} }; *************** *** 807,809 **** --- 818,835 ---- if (*cp == '-') *cp = '_'; } + #ifdef ENABLE_SYSLOG + bool + check_facility(const char *facility) + { + if (strcasecmp(facility,"LOCAL0") == 0) return true; + if (strcasecmp(facility,"LOCAL1") == 0) return true; + if (strcasecmp(facility,"LOCAL2") == 0) return true; + if (strcasecmp(facility,"LOCAL3") == 0) return true; + if (strcasecmp(facility,"LOCAL4") == 0) return true; + if (strcasecmp(facility,"LOCAL5") == 0) return true; + if (strcasecmp(facility,"LOCAL6") == 0) return true; + if (strcasecmp(facility,"LOCAL7") == 0) return true; + return false; + } + #endif -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
Larry Rosenman writes:
Ok, You guys are probably tired of me, BUT, here is another one, that
adds the facility to set the program name used in syslog.
(this includes the other ones).
Why would one want to do that? ISTM that that would just be a means to
play games with the sysadmin.
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
Larry Rosenman writes:
Ok, You guys are probably tired of me, BUT, here is another one, that
adds the facility to set the program name used in syslog.
(this includes the other ones).Why would one want to do that? ISTM that that would just be a means to
play games with the sysadmin.
Don't rule out the attractiveness of that. :-)
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Larry Rosenman writes:
* Peter Eisentraut <peter_e@gmx.net> [001113 17:43]:
Larry Rosenman writes:
Ok, You guys are probably tired of me, BUT, here is another one, that
adds the facility to set the program name used in syslog.
(this includes the other ones).Why would one want to do that? ISTM that that would just be a means to
play games with the sysadmin.test vs. production postgresDB's, virtual users (ala uunet), multiple
different pg's listening on different ports.
Okay, but you can't make these options PGC_SIGHUP unless you make sure to
close and re-open the syslog channel whenever these options
change. Probably ought to be PGC_POSTMASTER.
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
* Peter Eisentraut <peter_e@gmx.net> [001113 23:52]:
Okay, but you can't make these options PGC_SIGHUP unless you make sure to
close and re-open the syslog channel whenever these options
change. Probably ought to be PGC_POSTMASTER.
Is there a mechanism to "hear" the SIGHUP? Although, it probably
doesn't matter. I'll do a patch. I was just following the syslog
lead.
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
* Peter Eisentraut <peter_e@gmx.net> [001113 23:52]:
Okay, but you can't make these options PGC_SIGHUP unless you make sure to
close and re-open the syslog channel whenever these options
change. Probably ought to be PGC_POSTMASTER.
Here is a patch to change to PGC_POSTMASTER...
Index: guc.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.19
diff -c -r1.19 guc.c
*** guc.c 2000/11/14 01:15:02 1.19
--- guc.c 2000/11/14 13:11:33
***************
*** 309,317 ****
{"unix_socket_group", PGC_POSTMASTER, &Unix_socket_group,
"", NULL},
#ifdef ENABLE_SYSLOG
! {"syslog_facility", PGC_SIGHUP, &Syslog_facility,
"LOCAL0", check_facility},
! {"syslog_progid", PGC_SIGHUP, &Syslog_progid,
"postgres", NULL},
#endif
--- 309,317 ----
{"unix_socket_group", PGC_POSTMASTER, &Unix_socket_group,
"", NULL},
#ifdef ENABLE_SYSLOG
! {"syslog_facility", PGC_POSTMASTER, &Syslog_facility,
"LOCAL0", check_facility},
! {"syslog_progid", PGC_POSTMASTER, &Syslog_progid,
"postgres", NULL},
#endif
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749