Monday , May 20 2024

Where is the Log File In PostgreSQL


When there is an error in a database system, the first thing we do is look at the logs.

In this article, I will tell you where is the log file in PostgreSQL, and how to read those logs.

After you install PostgreSQL, you need to do the initdb process.

You can read the article titled “How To Install PostgreSQL Replication On Centos” for doing initdb.

There is a folder named log in the path you specify when you run the initdb process.

Log files are in this folder.


We enter this log folder with the cd command, and we run the following command.


Then you can read the latest log with the help of the following script.


To read the last 100 lines of this log file, you must run the script as follows.


About dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

Your email address will not be published. Required fields are marked *