Re: Logging on Gentoo

From: Richard Huxton <dev(at)archonet(dot)com>
To: Thom Brown <thombrown(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Logging on Gentoo
Date: 2009-01-14 12:26:05
Message-ID: 496DD9DD.2040903@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message ries van Twisk 2009-01-14 12:33:43 Strange invalid constrain problem with PostgreSQL 8.3.1
Previous Message Thom Brown 2009-01-14 12:09:46 Logging on Gentoo