IBM Support

Changing the mail settings of log file rotation

Question & Answer


Question

How can I change the mail settings of the log rotation on the NPS server?

Answer

You can have rotated logs sent to the default root account or to an e-mail address or you can have the logs saved on the server and no e-mail sent.

The following describes the three delivery options for logs that are rotated on the NPS server.

1.  You want the logs to go to the default root account.

This is the default behavior.  No setup is needed. You can type 'mail' when logged in as root on the NPS server to retrieve these e-mail messages.

     
2.  You want to send rotated logs to an e-mail address other than root:
 a.  Log in to the NPS server as root.
 b.  Edit the logrotate configuration file: vi /etc/logrotate.conf
 c.  Add the following lines after the "create" command:


 # Send rotated logs to this e-mail address
 #
    mail <your_email@address.com>
 


3.   You want the logs saved on the server and no e-mail sent:
 a.  Log in to the NPS server as root.
 b.  Edit the logrotate configuration file: vi /etc/logrotate.conf
 c.  Add the following lines after the "create" command:
 # Do not send e-mail with the last rotated log
 #
    nomail
 


A completed logrotate.conf file may look something like the following:
# see "man logrotate" for details
# rotate log files weekly

weekly


# keep 4 weeks worth of backlogs

rotate 4


# create new (empty) log files after rotating old ones

create


# do not send any logs via e-mail

nomail


# send log to e-mail address:
# uncomment this to use and comment the nomail
#
mail my_user@company.com

# uncomment this if you want your log files compressed
#
compress

# RPM packages drop log rotation information into this directory

include /etc/logrotate.d


# no packages own wtmp -- we'll rotate them here

/var/log/wtmp {
    monthly
    create 0664 root utmp
    rotate 1
}


# system-specific logs may be also be configured here
. 


After making your changes, you can restart cron by issuing the following command: /etc/init.d/crond restart.  Your changes should take effect when logrotate runs again.  

You may wonder why the Postgres log is not listed here.  Netezza includes a separate configuration file for this purpose.  It is located at /etc/logrotate.d/netezza. 

[{"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

NZ137386

Document Information

Modified date:
17 October 2019

UID

swg21572027