Assuming the default postgresql.conf
as shipped with Ubuntu's PostgreSQL package, a plausible reason for these huge log files would be that your data import would generate tons on warnings like this:
2012-06-11 14:00:01 CEST WARNING: nonstandard use of \ in a string literal at character 25
2012-06-11 14:00:01 CEST HINT: Use the escape string syntax for backslashes, e.g., E'\'.
Run sudo more /var/log/postgresql/postgresql-8.4-main.log
to check the actual contents of the latest log file.
If these warnings are the reason why the log files are huge, they can be muted by setting escape_string_warning
to OFF in /etc/postgresql/8.4/main/postgresql.conf
See the compatibility notes in postgresql 8.4 docs for why this warning kicks in.
The other default logging settings of PostgreSQL on Ubuntu are:
- log_destination='stderr'
- log_statement=none
- log_connections=off
These are sane values that should not produce log overflow.
The log rotation is handled by logrotate and configured in /etc/logrotate.d/postgresql-common
.
By default, it's:
/var/log/postgresql/*.log {
weekly
rotate 10
copytruncate
delaycompress
compress
notifempty
missingok
}
Should you want to reduce the number of log files or accelerate their deletion, this is the file to modify. But it would better to identify and suppress the root cause of these huge logs.
/var/log/postgres
contains the regular logfiles. Just turn down the loglevel to write less logging information: postgresql.org/docs/current/static/runtime-config-logging.html – a_horse_with_no_name Jun 10 '12 at 10:59