Re: log_statement at postgres.conf - Mailing list pgsql-performance

From Pomarede Nicolas
Subject Re: log_statement at postgres.conf
Date
Msg-id Pine.LNX.4.64.0807171134490.17374@localhost
Whole thread Raw
In response to Re: log_statement at postgres.conf  ("Claus Guttesen" <kometen@gmail.com>)
List pgsql-performance
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

pgsql-performance by date:

Previous
From: "Claus Guttesen"
Date:
Subject: Re: log_statement at postgres.conf
Next
From: Jeff Frost
Date:
Subject: index scan cost