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.
tail -f postgresql-Sat.log
To read the last 100 lines of this log file, you must run the script as follows.
tail -100f postgresql-Sat.log