Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 98B6E64FF4F for ; Thu, 17 Jul 2008 06:40:21 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 27584-05 for ; Thu, 17 Jul 2008 06:40:13 -0300 (ADT) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp8-g19.free.fr (smtp8-g19.free.fr [212.27.42.65]) by postgresql.org (Postfix) with ESMTP id 6EB1765049F for ; Thu, 17 Jul 2008 06:40:16 -0300 (ADT) Received: from smtp8-g19.free.fr (localhost [127.0.0.1]) by smtp8-g19.free.fr (Postfix) with ESMTP id AB1B917F55B; Thu, 17 Jul 2008 11:40:14 +0200 (CEST) Received: from pulsar.staff.proxad.net (pulsar.staff.proxad.net [213.228.1.109]) by smtp8-g19.free.fr (Postfix) with ESMTP id F3D6D17F532; Thu, 17 Jul 2008 11:40:13 +0200 (CEST) Date: Thu, 17 Jul 2008 11:40:13 +0200 (CEST) From: Pomarede Nicolas X-X-Sender: npomarede@localhost To: Claus Guttesen cc: System/IJS - Joko , pgsql-performance@postgresql.org Subject: Re: log_statement at postgres.conf In-Reply-To: Message-ID: References: <01a601c8e7e9$41ad45d0$12068cc0@edp03> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200807/140 X-Sequence-Number: 30740 On Thu, 17 Jul 2008, Claus Guttesen wrote: >> After setting log_statement='all' at postgres.conf, >> then i'm rebooting OS [freeBSD or CentOS], >> i can't find where log file created from log_statement='all' located... >> FYI, location of postgres.conf at /var/lib/pgsql/data/postgres.conf >> >> many thanks.. > > I added the following to FreeBSD: > > /etc/newsyslog.conf: > /var/log/postgresql 600 7 * @T00 JC > > /etc/syslog.conf: > local0.* /var/log/postgresql > > /usr/local/pgsql/data/postgresql.conf: > log_destination = 'syslog' > syslog_facility = 'LOCAL0' > syslog_ident = 'postgres' > log_min_duration_statement = 100 # -1 is disabled, 0 logs all > statements, in ms. > > Remember to touch /var/log/postgresql before restarting syslogd (kill > -HUP syslog-pid). Chmod 0700 so only root can read the log-file. > Adjust log_min_duration_statement to your needs. > > I found this recipe somewhere, but don't remember where so I can't > give credit to the that person. > Hello, another possibility is to have logs stored in a file by just changing 'redirect_stderr' to 'on' and 'log_destination' to 'stderr'. This way, with the default config, all logs sent to stderr will be written to 'log_directory' under the name 'log_filename', without having to change syslog.conf (you just need to change postgresql.conf). Additionaly, I added 'log_rotation_size = 0' to have on log file per day. Note that in that case, the log files won't be rotated, you'll need to check you don't store too many log file after a few months (as the number of files will increase every day). Nicolas