Question & Answer
Question
What do I need to understand about managing the size of the Postgres database log file?
Answer
The management of the pg.log is governed by /etc/logrotate.d/netezza which is defined as follows:
/nz/kit/log/postgres/pg.log {
size 1024M
missingok
postrotate
pkill -HUP -f postmaster 2>/dev/null || true
endscript
}
These settings cause the pg.log file to rotate out when it has reached 1 GB in size. If necessary, you can modify the attributes to rotate the log daily, or when it reaches a smaller size.
To rotate the Postgres log daily and only keep four weeks of pg.logs online, modify the/etc/logrotate.d/netezza file to read as follows:
/nz/kit/log/postgres/pg.log {
size 1024M
daily
rotate 28
missingok
postrotate
pkill -HUP -u nz -f postmaster 2>/dev/null || true
endscript
}
'daily' instructs Postgres to rotate the file daily in addition to when the size reaches 1GB. 'rotate 28' instructs it to keep 28 rotated logs online -- or 4 weeks.
The logrotate command is supplied with Red Hat Linux. You can learn more about this command from the Red Hat manual page by running the following command:
man logrotate
Also, if you find you need to force the pg.log to rotate, you can issue the following command:
/usr/sbin/logrotate -f /etc/logrotate.d/netezza
DO NOT JUST COPY THE ACTIVE PG.LOG TO ANOTHER LOCATION ON A RUNNING SYSTEM.
Historical Number
NZ849198
Was this topic helpful?
Document Information
More support for:
IBM PureData System
Software version:
1.0.0
Document number:
463603
Modified date:
17 October 2019
UID
swg21571378