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.