Sunday, March 15, 2015

Solaris 10 & Above: LOGROTATE configuration using logadm

Solaris 10 & above versions have builtin "logadm" utility meant for logfile rotation.
Options for logadm command:


-w:             Modify the configuration file
-c <count>:     Delete the oldest versions until there are no more than <count> files left.
-p <period>:    Rotate the logfiles after a specified time period
    Example:    -p 30d = 30 days
                -p 2w = 2 weeks
                -p 4m = 4 months
                -p 2y = 2 years
-s <size>:      Size limit of the file


LOGROTATE CONFIGURATION

1st Option:


# logadm –w /var/apache/logs/access_logs –s 100m
# logadm –w /oracle/bdump/alert_db.log –p 7d –c 10 

2nd Option:


# cd /etc
# vi logadm.conf 

- Add:


/var/apache/logs/access_logs –s 100m
/oracle/bdump/alert_db.log –p 7d –c 10
  
- Save & Exit.
- Restart logrotate – DONE.

No comments:

Post a Comment