PostgreSQL: 7.3.3
OS: Redhat 7.2
Changing the syslog facility (syslog_facility) in
the configuration file has no effect after sending a SIGHUP to the
postmaster.
The only way to get the change is to restart the
postmaster.
Not sure whether this is a bug or it is suppose to
behave this way.
Certainly it is not documented as if though you
need to do a restart. For example some setting have "This option must be set at
server start".
I know its not a biggie but its another one of
those things that you can waste a lot of time on when you are following all the
correct instructions... How to reproduce:
Edit your /etc/syslog.conf file such that the
messages log file filters out all local0 and local3 sources.
e.g.
*.info;mail.none;authpriv.none;cron.none;local3.none;local0.none
/var/log/messages
Add to the /etc/syslog.conf file the
following lines
local0.*
/var/log/postgres0
local3.*
/var/log/postgres3
save the file and do a SIGHUP on the syslogd
process
e.g.
kill -HUP `cat /var/run/syslogd.pid`
make sure postgreSQL logging is turned on and for
this example also set log connections to true.
e.g.
edit the /var/lib/pgsql/data/postgresql.conf file
(or the appropriate one according to your installation) such that
log_connections = true
syslog =
2
syslog_facility = 'LOCAL0' Do a SIGHUP on the postmaster.
Make a connection to a database using some client
software (psql will do).
Drop the connection.
View the log file /var/log/postgres0, it should
have some entries like:
Jul 2 20:27:45 CISX_Linux1 postgres[10848]: [1] LOG: Received SIGHUP, reloading configuration files Jul 2 20:29:14 CISX_Linux1 postgres[10957]: [2] LOG: connection received: host=192.168.100.22 port=2794 Jul 2 20:29:14 CISX_Linux1 postgres[10957]: [3] LOG: connection authorized: user=postgres database=template1 Jul 2 20:29:15 CISX_Linux1 postgres[10958]: [2] LOG: connection received: host=192.168.100.22 port=2795 Jul 2 20:29:15 CISX_Linux1 postgres[10958]: [3] LOG: connection authorized: user=postgres database=template1 Jul 2 20:29:17 CISX_Linux1 postgres[10959]: [2] LOG: connection received: host=192.168.100.22 port=2797 Jul 2 20:29:17 CISX_Linux1 postgres[10959]: [3] LOG: connection authorized: user=postgres database=Bugs Now edit the postgresql.conf file such
that:
syslog_facility = 'LOCAL3'
Do a SIGHUP on the postmaster.
Re-connect to a database again using some client
software as before.
Drop the connection.
View the log file /var/log/postgres3, it should
have the connection entries as in above but it doesn't!
View the log file /var/log/postgres0, it has all
the connections that occurred after editing the configuration file and doing a
SIGHUP!
e.g.
Jul 2 20:27:45 CISX_Linux1 postgres[10848]: [1] LOG: Received SIGHUP, reloading configuration files Jul 2 20:29:14 CISX_Linux1 postgres[10957]: [2] LOG: connection received: host=192.168.100.22 port=2794 Jul 2 20:29:14 CISX_Linux1 postgres[10957]: [3] LOG: connection authorized: user=postgres database=template1 Jul 2 20:29:15 CISX_Linux1 postgres[10958]: [2] LOG: connection received: host=192.168.100.22 port=2795 Jul 2 20:29:15 CISX_Linux1 postgres[10958]: [3] LOG: connection authorized: user=postgres database=template1 Jul 2 20:29:17 CISX_Linux1 postgres[10959]: [2] LOG: connection received: host=192.168.100.22 port=2797 Jul 2 20:29:17 CISX_Linux1 postgres[10959]: [3] LOG: connection authorized: user=postgres database=Bugs Jul 2 20:36:48 CISX_Linux1 postgres[10848]: [2] LOG: Received SIGHUP, reloading configuration files these shouldn't have been here? Jul 2 20:37:01 CISX_Linux1 postgres[10969]: [3] LOG: connection received: host=192.168.100.22 port=3292 Jul 2 20:37:01 CISX_Linux1 postgres[10969]: [4] LOG: connection authorized: user=postgres database=template1 Jul 2 20:37:01 CISX_Linux1 postgres[10970]: [3] LOG: connection received: host=192.168.100.22 port=3293 Jul 2 20:37:01 CISX_Linux1 postgres[10970]: [4] LOG: connection authorized: user=postgres database=template1 Jul 2 20:37:05 CISX_Linux1 postgres[10971]: [3] LOG: connection received: host=192.168.100.22 port=3298 Jul 2 20:37:05 CISX_Linux1 postgres[10971]: [4] LOG: connection authorized: user=postgres database=Bugs Jul 2 20:37:07 CISX_Linux1 postgres[10972]: [3] LOG: connection received: host=192.168.100.22 port=3300 Jul 2 20:37:07 CISX_Linux1 postgres[10972]: [4] LOG: connection authorized: user=postgres database=CISX If you now restart the postmaster
e.g.
/etc/init.d/postgresql restart
and now make a connection to the database as before
you will find that all logging is going to the correct log file. That is the
postmaster has updated and using the correct syslog facility setting as
specified in the configuration file.
Regards
Donald Fraser.
|
- Re: [BUGS] Minor bug with syslog facility Donald Fraser