Thread: Logging on Gentoo
Hi,
I've configured Postgres to log to stderr and defined my log directory correctly with permissions to postgres on both user and group. I've restarted postgres (not reloaded) but nothinig is coming out. Upon reading the documentation for using stderr, it mentions the need to change the system's syslog daemon.
It says it should look something like "local0.* /var/log/postgresql"
I can't find this syslog configuration. I have a file in /etc/syslog-ng called syslog-ng.conf which contains the following:
##########################################################################
# $Header: /var/cvsroot/gentoo-x86/app-admin/syslog-ng/files/syslog-ng.conf.gentoo,v 1.7 2007/08/02 04:52:18 mr_bones_ Exp $
#
# Syslog-ng default configuration file for Gentoo Linux
# contributed by Michael Sterrett
options {
chain_hostnames(off);
sync(0);
# The default action of syslog-ng 1.6.0 is to log a STATS line
# to the file every 10 minutes. That's pretty ugly after a while.
# Change it to every 12 hours so you get a nice daily update of
# how many messages syslog-ng missed (0).
stats(43200);
};
source src {
unix-stream("/dev/log" max-connections(256));
internal();
file("/proc/kmsg");
};
destination messages { file("/var/log/messages"); };
# By default messages are logged to tty12...
destination console_all { file("/dev/tty12"); };
# ...if you intend to use /dev/console for programs like xconsole
# you can comment out the destination line above that references /dev/tty12
# and uncomment the line below.
#destination console_all { file("/dev/console"); };
log { source(src); destination(messages); };
log { source(src); destination(console_all); };
######################################################################
I can't see how I would change this as per the documentation's recommendations. Am I looking at the right configuration file?
I'm using PostgreSQL 8.3.5 on an up-to-date Gentoo. I had a look at this problem about 6 months ago and had the same problem, but now I want to get it working.
Thanks
Thom
I've configured Postgres to log to stderr and defined my log directory correctly with permissions to postgres on both user and group. I've restarted postgres (not reloaded) but nothinig is coming out. Upon reading the documentation for using stderr, it mentions the need to change the system's syslog daemon.
It says it should look something like "local0.* /var/log/postgresql"
I can't find this syslog configuration. I have a file in /etc/syslog-ng called syslog-ng.conf which contains the following:
##########################################################################
# $Header: /var/cvsroot/gentoo-x86/app-admin/syslog-ng/files/syslog-ng.conf.gentoo,v 1.7 2007/08/02 04:52:18 mr_bones_ Exp $
#
# Syslog-ng default configuration file for Gentoo Linux
# contributed by Michael Sterrett
options {
chain_hostnames(off);
sync(0);
# The default action of syslog-ng 1.6.0 is to log a STATS line
# to the file every 10 minutes. That's pretty ugly after a while.
# Change it to every 12 hours so you get a nice daily update of
# how many messages syslog-ng missed (0).
stats(43200);
};
source src {
unix-stream("/dev/log" max-connections(256));
internal();
file("/proc/kmsg");
};
destination messages { file("/var/log/messages"); };
# By default messages are logged to tty12...
destination console_all { file("/dev/tty12"); };
# ...if you intend to use /dev/console for programs like xconsole
# you can comment out the destination line above that references /dev/tty12
# and uncomment the line below.
#destination console_all { file("/dev/console"); };
log { source(src); destination(messages); };
log { source(src); destination(console_all); };
######################################################################
I can't see how I would change this as per the documentation's recommendations. Am I looking at the right configuration file?
I'm using PostgreSQL 8.3.5 on an up-to-date Gentoo. I had a look at this problem about 6 months ago and had the same problem, but now I want to get it working.
Thanks
Thom
Thom Brown wrote: > Hi, > > I've configured Postgres to log to stderr and defined my log directory > correctly with permissions to postgres on both user and group. I've > restarted postgres (not reloaded) but nothinig is coming out. Upon reading > the documentation for using stderr, it mentions the need to change the > system's syslog daemon. > > It says it should look something like "local0.* /var/log/postgresql" Only if you're logging to syslog. > > I can't find this syslog configuration. I have a file in /etc/syslog-ng > called syslog-ng.conf which contains the following: [snip] > I can't see how I would change this as per the documentation's > recommendations. Am I looking at the right configuration file? You'd probably need to check the syslog-ng manuals. All the syslog (original) line does is send everything that comes from local0 (which is what PG logs as) to /var/log/postgresql. > I'm using PostgreSQL 8.3.5 on an up-to-date Gentoo. I had a look at this > problem about 6 months ago and had the same problem, but now I want to get > it working. What you want in your postgresql.conf is something like: log_destination = stderr logging_collector = on log_directory = '/var/log/pgsql83' log_filename = 'postgresql-%Y-%m-%d.log' log_rotation_age = 1d If permissions on /var/log/pgsql83 are correct that should generate a new log-file every day with the year-month-day in the filename. You can check settings from within psql with: "show log_destination;" etc. or see them in one go: SELECT name,setting,unit,category,source FROM pg_settings WHERE name LIKE 'log%'; HTH -- Richard Huxton Archonet Ltd
Tsk... that was it after all. I didn't have logging_collector set to on, and thanks to that helpful query you mentioned, I could see that the default was "off". The reason I didn't change it was because I was trying to copy the settings from a server I use at work which does output logging, but there's no logging_collector setting on that version.
I now have a logging file.
Thanks for your help :)
Thom
I now have a logging file.
Thanks for your help :)
Thom
2009/1/14 Richard Huxton <dev@archonet.com>
Thom Brown wrote:Only if you're logging to syslog.
> Hi,
>
> I've configured Postgres to log to stderr and defined my log directory
> correctly with permissions to postgres on both user and group. I've
> restarted postgres (not reloaded) but nothinig is coming out. Upon reading
> the documentation for using stderr, it mentions the need to change the
> system's syslog daemon.
>
> It says it should look something like "local0.* /var/log/postgresql"[snip]
>
> I can't find this syslog configuration. I have a file in /etc/syslog-ng
> called syslog-ng.conf which contains the following:> I can't see how I would change this as per the documentation'sYou'd probably need to check the syslog-ng manuals. All the syslog
> recommendations. Am I looking at the right configuration file?
(original) line does is send everything that comes from local0 (which is
what PG logs as) to /var/log/postgresql.What you want in your postgresql.conf is something like:
> I'm using PostgreSQL 8.3.5 on an up-to-date Gentoo. I had a look at this
> problem about 6 months ago and had the same problem, but now I want to get
> it working.
log_destination = stderr
logging_collector = on
log_directory = '/var/log/pgsql83'
log_filename = 'postgresql-%Y-%m-%d.log'
log_rotation_age = 1d
If permissions on /var/log/pgsql83 are correct that should generate a
new log-file every day with the year-month-day in the filename.
You can check settings from within psql with: "show log_destination;"
etc. or see them in one go:
SELECT name,setting,unit,category,source FROM pg_settings WHERE name
LIKE 'log%';
HTH
--
Richard Huxton
Archonet Ltd