PostgreSQL database configuration CSV format log output

Source: Internet
Author: User
Tags postgresql

PostgreSQL Database configuration csv format log output

The following is an introduction to the Setup method for the CSV format log (a more verbose log output in PG) in the PostgreSQL database.

1. go to the $PGDATA directory (PG installation directory, depending on the specific case name) to locate the configuration file postgresql.conf

2. turn on the csvlog output function :

#开启csvlog输出功能 (default is OFF)

Logging_collector = On

Note: you will need to restart the database after modifying the Logging_collector (you can also continue with the configuration after all configuration has been completed and then restarted)

#设置csv日志输出目录 ($PGDATA directory, if the directory does not exist, the system will be automatically created )

log_directory = ' Pg_log '

#设置输出的日志格式 (type), the log types in PG are stderr,csvlog,syslog, and EventLog, which are set to Csvlog in this example

#该选项默认为stderr Types
log_destination = ' Csvlog '

All configurations are over, and if you do not restart the data after configuring Logging_collector , reboot the database to be OK.

3. Description of the log_statement configuration :

Log_statement defaults to None, indicating that only system information (such as database startup, database connection, database shutdown, and so on) is logged.

Other optional configurations are DDL, mod and all. Where "DDL" represents the database definition language, including Drop,create,alter,grant,revoke, truncate and other statement execution records, "mod" indicates that the record database executes update UPDATE statement records, "all" Indicates that all execution records are logged. It is not recommended to set it to all easily, otherwise the database will generate a lot of logs and occupy more hard disk space.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.