This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing an important topic for PostgreSQL Database Professional.
A database log is necessary for finding different statuses, errors, bad queries and any changes on the Database Server.
A Database Administrator can also log different executed queries and analyze those for performance tuning.
Following are few relevant parameters for enabling the PostgreSQL log for all the queries.
Please open your postgresql.conf file and make sure about all logs related parameter’s value which are mentioned below.
- log_directory = ‘pg_log’ (default directory name)
- log_filename = ‘postgresql-%Y-%m-%d_%H%M%S.log’ (default file name structure)
- log_statement = ‘all’ (value ‘all’ is recommended {none, ddl, mod, all})
- logging_collector = ON
- log_line_prefix = ‘%t %c %u ‘ (time, sessionid, user)
- log_destination = ON (stderr,syslog,csvlog,eventlog)
- log_rotation_size = 15MB
- log_rotation_age = 1d (create new log file every day)