Thread: 8.3 Logging Question

8.3 Logging Question

From
"Chris Hoover"
Date:
I'm running PG 8.3rc2 to start testing it out, and really like how it is preforming for me so far.  However, I have one question on the logging.  I am trying to use syslog and csvlog to log all sql.  This seems to work great except that for every log rotation postgres does, I get a .csv log file that grows and a 0 byte .log file.  Since I'm not logging to stderr, why is the .log file being created, and how do I turn that off?

Thanks for your help,

Chris

Relevent config file portion:

#------------------------------------------------------------------------------
# ERROR REPORTING AND LOGGING
#------------------------------------------------------------------------------

# - Where to Log -

log_destination = 'syslog,csvlog'               # Valid values are combinations of
                                        # stderr, csvlog, syslog and eventlog,
                                        # depending on platform.  csvlog
                                        # requires logging_collector to be on.

# This is used when logging to stderr:
logging_collector = on                  # Enable capturing of stderr and csvlog
                                        # into log files. Required to be on for
                                        # csvlogs.
                                        # (change requires restart)

# These are only used if logging_collector is on:
log_directory = 'pg_log'                # directory where log files are written,
                                        # can be absolute or relative to PGDATA
#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'        # log file name pattern,
                                        # can include strftime() escapes
log_truncate_on_rotation = on           # If on, an existing log file of the
                                        # same name as the new log file will be
                                        # truncated rather than appended to.
                                        # But such truncation only occurs on
                                        # time-driven rotation, not on restarts
                                        # or size-driven rotation.  Default is
                                        # off, meaning append to existing files
                                        # in all cases.
log_rotation_age = 1h                   # Automatic rotation of logfiles will
                                        # happen after that time.  0 to disable.
log_rotation_size = 0                   # Automatic rotation of logfiles will
                                        # happen after that much log output.
                                        # 0 to disable.

# These are relevant when logging to syslog:
syslog_facility = 'LOCAL0'
syslog_ident = 'postgres'

Re: 8.3 Logging Question

From
"Chris Hoover"
Date:
> [...]
> log_destination = 'syslog,csvlog'               # Valid values are
> combinations of

This is kind of strange. It should be syslog or csvlog. It shouldn't be
both of them. Or am I wrong ?

Regards.


--
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com

The documentation stated you could log to multiple destinations by comma separating them.

Since this is my personal test area, I'm looking at both types of logging.  I am very interested in being able to load the logs into a table so that I can do further mining on them, so I am testing the csvlog.  I have also been wanting to try the syslog feature for the logs, so I am testing this also.  Really nice to have the option to send the logs to multiple outlets.

HTH.

Chris

Re: 8.3 Logging Question

From
Guillaume Lelarge
Date:
Chris Hoover wrote:
> I'm running PG 8.3rc2 to start testing it out, and really like how it is
> preforming for me so far.  However, I have one question on the logging.
> I am trying to use syslog and csvlog to log all sql.  This seems to work
> great except that for every log rotation postgres does, I get a .csv log
> file that grows and a 0 byte .log file.  Since I'm not logging to
> stderr, why is the .log file being created, and how do I turn that off?
>

Yes, I have the same issue. I don't think you can do something to stop
this behaviour. postmaster process creates the directory if not present,
then tries to create a file in it, and finally launches the syslogger
subprocess. The file it creates is your .log file. I'm not sure why it
creates a .log file. Perhaps the postmaster process has no idea at this
time that the DBA wants csvlog files.

Anyways, you'll only have one .log file because rotation function takes
care of the log_destination.

> [...]
> log_destination = 'syslog,csvlog'               # Valid values are
> combinations of

This is kind of strange. It should be syslog or csvlog. It shouldn't be
both of them. Or am I wrong ?

Regards.


--
Guillaume.
  http://www.postgresqlfr.org
  http://dalibo.com

Re: 8.3 Logging Question

From
Tom Lane
Date:
"Chris Hoover" <revoohc@gmail.com> writes:
> I'm running PG 8.3rc2 to start testing it out, and really like how it is
> preforming for me so far.  However, I have one question on the logging.  I
> am trying to use syslog and csvlog to log all sql.  This seems to work great
> except that for every log rotation postgres does, I get a .csv log file that
> grows and a 0 byte .log file.  Since I'm not logging to stderr, why is the
> .log file being created, and how do I turn that off?

The .log file is to catch any non-csv-format data that comes down the
pipe.  You can't turn it off.

            regards, tom lane

Re: 8.3 Logging Question

From
"Chris Hoover"
Date:


On Jan 24, 2008 5:38 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

The .log file is to catch any non-csv-format data that comes down the
pipe.  You can't turn it off.

                       regards, tom lane

What type of data would you expect this to be?

Re: 8.3 Logging Question

From
Tom Lane
Date:
"Chris Hoover" <revoohc@gmail.com> writes:
> On Jan 24, 2008 5:38 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> The .log file is to catch any non-csv-format data that comes down the
>> pipe.  You can't turn it off.

> What type of data would you expect this to be?

Any bit of code that doesn't know about elog, for instance

--- shared library linking problems from the dynamic loader
--- complaints from perl, python, or other libraries you might have
    loaded into the backend
--- corrupted-memory messages out of glibc (malloc)
--- yadda yadda yadda

One of the main strikes against syslog logging has always been that
it fails to capture this type of stuff.  You don't realize you need
this until you need it, but then you really do.

            regards, tom lane