Re: Logging on Gentoo - Mailing list pgsql-general

From Thom Brown
Subject Re: Logging on Gentoo
Date
Msg-id bddc86150901140440j77397328k803cb0e9257bd645@mail.gmail.com
Whole thread Raw
In response to Re: Logging on Gentoo  (Richard Huxton <dev@archonet.com>)
List pgsql-general
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

2009/1/14 Richard Huxton <dev@archonet.com>
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

pgsql-general by date:

Previous
From: ries van Twisk
Date:
Subject: Strange invalid constrain problem with PostgreSQL 8.3.1
Next
From: pere roca
Date:
Subject: simple limit of decimals