Tuesday 13 December 2011

### Log Rotation ###



  1. Rotation of logs based on criteria
   a. size
   b. age (daily, weekly, monthly)

  2. Compression
  3. Maintain logs for a defined period


/etc/logrotate.conf - primary (global) config file for all logs
 -can be overriden by context-sensitive files. i.e. apache
 run 'man logrotate'

/etc/logrotate.d - directory for logs to be rotated
 -httpd - used to rotate Apache logs

/var/log/httpd/*log {
    missingok
    notifempty
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
    endscript
}


Task: Setup rotation rule for Cisco log
 1. Create entry in: /etc/logrotate.d based on /etc/logrotate.d/syslog

 2. Modified the entry to rotate based on new criteria
 3. Rotated using: 'logrotate /etc/logrotate.conf'
Note: Force using: 'logrotatate -f /etc/logrotate.conf'

No comments:

Post a Comment