Wednesday 13 July 2016

postgresql logging

below properties can be updated in postgresql.conf file

Where To Log

  • log_destination-Valid values are combinations of stderr, csvlog, syslog, and eventlog, depending on platform.
  • logging_collector-Enables advanced logging features. csvlogrequires logging_collector.
  • log_directory-Directory where log files are written. Requires logging_collector.
  • log_filename-Format of log file name (e.g. enterprisedb-%Y-%M-%d-%h%m%s.log). Allows regular log rotation. Requires logging_collector.
  • log_file_mode(default 0600) -On Unix systems this parameter sets the permissions for log files when logging_collectoris enabled.
  • log_rotation_age-Automatically rotate logs after this much time. Requires logging_collector.
  • log_rotation_size-Automatically rotate logs when they get this big. Requires logging_collector.


When To Log

  • client_min_messages(default NOTICE) -Messages of this severity level or above are sent to the client.
  • log_min_messages(default WARNING) -Messages of this severity level or above are sent to the server.
  • log_min_error_statement(default ERROR) -When a message of this severity or higher is written to the server log, the statement that caused it is logged along with it.
  • log_min_duration_statement(default -1, disabled) -When a statement runs for at least this long, it is written to the server log, with its duration.


What To Log

  • log_connections(default off) -Log successful connections to the server log.
  • log_disconnections(default off) -Log some information each time a session disconnects, including the duration of the session.
  • log_error_verbosity(default “default”) -Can also select “terse” or “verbose”.
  • log_duration(default off) -Log duration of each statement.
  • log_line_prefix-Additional details to log with each line.
  • log_statement(default none) -Legal values are none, ddl, mod (DDL and all other data-modifying statements), or all.
  • log_temp_files(default -1) -Log temporary files of this size or larger, in kilobytes.
  • log_checkpoints(default off) -Causes checkpoints and restartpointsto be logged in the server log.

No comments:

Post a Comment