Configure log output in csv format in postgresql database

Source: Internet
Author: User
The following describes how to configure csv log output in postgresql database (a more detailed log output method in postgresql. 1. Go to the $ PGDATA directory (postgresql installation directory, which varies according to the actual name) and find the configuration file postgresql. conf2. enable the csvlog output function: # enable cs

The following describes how to configure csv log output in postgresql database (a more detailed log output method in postgresql. 1. Go to the $ PGDATA directory (postgresql installation directory, which varies according to the actual name) and find the configuration file postgresql. conf 2. Enable the csvlog output function: # enable cs

Configure log output in csv format in postgresql database

The following describes how to set up csv format logs (a more detailed log output method in postgresql.

1.Go to the $ PGDATA directory (pg installation directory, which varies according to the actual name) and find the configuration file postgresql. conf.

2.Enable csvlog output:

# Enable csvlog output (off by default)

Logging_collector = on

Note: After modifying logging_collector, You need to restart the database (of course, you can continue the configuration and restart it after all the configurations are complete)

# Set the csv log output directory (in the $ PGDATA directory, if this directory does not exist, the system will automatically create it)

Log_directory = 'pg _ Log'

# Set the output log format (type). The log types in pg include stderr, csvlog, syslog, and eventlog. In this example, set the format to csvlog.

# This option is of the stderr type by default.
Log_destination = 'svlog'

All configurations are complete. If data is not restarted after logging_collector is configured, restart the database.

3.Description of log_statement Configuration:

Log_statement is set to none by default, indicating that only the running status information of system information is recorded (such as database startup, database connection, and database shutdown ).

Other options include ddl, mod, and all. "Ddl" indicates the database definition language, including the execution records of statements such as DROP, CREATE, ALTER, GRANT, REVOKE, and TRUNCATE, and "mod" indicates the records of the update statements executed by the database, "all" indicates recording all execution records. We recommend that you do not set it to all easily. Otherwise, the database will generate a large amount of logs, occupying a large amount of hard disk space.

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.