IBM Support

NPS log file management

Question & Answer


Question

How are the NPS log files rotated? 

Answer

The process of PureData System for Analytics log file rotation is briefly described in the IBM Netezza System Administrator’s Guide. The following is an excerpt regarding pg.log:

For postgres logs, the system checks the size the of the log file daily and rolls it over if it is greater than 1 GB in size or older than a week. The system keeps four weeks of archived log files plus the current week.



This process occurs by using the /etc/logrotate.d/netezza file which should be similar to the following:

/nz/kit/log/postgres/pg.log {

size 1024M

postrotate

pkill -HUP -f postmaster 2>/dev/null 0x7C0x7C true

endscript

}

The pg.log will rotate when its size is larger than 1024M. The "pkill -HUP -f postmaster" instruction does not actually kill postmaster but rather alerts postmaster to reload its configuration, which in turn releases a lock on pg.log.


 Summary of Log File Rotation

1. The /etc/cron.daily/logrotate.conf file is defined during the initial setup at time of installation and contains the following entry:

#!/bin/sh

/usr/sbin/logrotate /etc/logrotate.conf

2. Initial settings are defined when the cron.daily file starts /usr/sbin/logrotate and passes the /etc/logrotate.conf script. By default, those settings include the following (per /etc/logrotate.conf):

  • Keep at most four weeks of logs
  • Rotate these logs weekly

3. The /etc/logrotate.conf  performs an include /etc/logrotate.d which will cause logrotate to act upon all files in the /etc/logrotate.d path, of which /etc/logrotate.d/netezza is included.

 Thus NPS reverts to the original definition of /etc/logrotate.d/netezza defined as

/nz/kit/log/postgres/pg.log {

size 1024M

postrotate

pkill -HUP -f postmaster 2>/dev/null 0x7C0x7C true

endscript

}

Given this definition we will only rotate the /nz/kit/log/postgres/pg.log when its size is greater than 1024M or the file is older than one week (as a result of the definition in /etc/logrotate.conf).

If you want to allow for more frequent rotations, modify the /etc/logrotate.d/netezza file by adding the following lines after the line for size 1024M:

  • daily
  • rotate 28

With these additions, the log will be rotated every day or when the file size is greater than 1024M. Also "rotate 28" ensures that four weeks of pg.logs remain at all times on the server.

[{"Product":{"code":"SSULQD","label":"IBM PureData System"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":null,"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"1.0.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number

NZ209694

Document Information

Modified date:
17 October 2019

UID

swg21568937