Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

If you wish to backup old logs using olddir in logrotate it may create problem while giving separate partition for backup.

Logrotate and move to backup directory

Firstly i would suggest you to remove /var/log/messages from /etc/logrotate.d/syslog

vi /etc/logrotate.d/syslog

remove line /var/log/messages

vi /etc/logrotate.d/messages

Paste belwo given.

/var/log/messages
{
        daily
        rotate 10
        missingok
        postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
        /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
        /var/log/messagesrotate.sh || true
        endscript
}

::::::::::::::::::::: Script to run in Postrotate :::::::::::::::::::::::::::::::

#!/bin/bash
LogDate=$(date +"%s")
mv /var/log/messages.1 /data/logs/local_backup/var/log/messages/messages.$LogDate
gzip /data/logs/messages.$LogDate
exit