Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop PostgreSQL log files from filling up disk

Tags:

postgresql

I'm running PostgreSQL 8.4 on an Ubuntu server. I realized that my disk is out of space because the log file had became too large. Can I adjust what gets written to the log file?

like image 931
goh Avatar asked Jan 17 '11 04:01

goh


People also ask

Can I delete PostgreSQL log files?

PostgreSQL supports log rotation feature but doesn't support log removing feature. So user should remove logs manually or has to use logrotate utility to remove them.

Where are Postgres logs stored?

The location of the log file will depend on the configuration. On Debian-based systems the default is /var/log/postgresql/postgresql-9.3-main. log (replace 9.3 with your version of PostgreSQL). On Red Hat-based systems it is located in /var/lib/pgsql/data/pg_log/ .


1 Answers

Edit /etc/postgresql/8.4/main/postgresql.conf and change or disable the various log_* parameters. Then reload postgresql.

You might also want to check what gets written to the logs. By default, there should not be that much logging. Possibly, your application is throwing lots of errors, which is what's filling up your hard disks.

like image 159
Peter Eisentraut Avatar answered Sep 30 '22 15:09

Peter Eisentraut