In a debian 8 box I got a PostgreSQL 9.4 up and running in production environment. Recently I found that the postgres-9.4-main.log is larger than 38 GB. I have adjusted the postgresql.conf log_truncate_on_rotation parameter to true and restarted the cluster.

It's all fine but I still have the 38 GB log file. How can I get rid of it?


If you stop your database, it is safe to remove the log file (unless you need it for checking something later, so it is probably better to back it up somehow). Upon restart, an empty file will be created and subsequently written to. If you remove the file while the cluster is running, there is some chance you'll get errors about the missing file (I'm not completely sure about the errors), or just missing logs until the next rotation occurs. With some combination of config parameters, it is even possible that they will be missing until the next restart.

| improve this answer | |
  • Thanks a lot. I'll be able to stop the cluster later today and I'll let you know the results as soon as done. – marvin.deoliveira Aug 9 '16 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.