Friday, 14 August 2015

How to change /var/log/messages permission in Linux

Add below lines in /etc/logrotate.d/syslog



[root@test001 log]# cat /etc/logrotate.d/syslog
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {
create 0644 root root
rotate 6
weekly
    sharedscripts
    postrotate
/etc/init.d/syslog reload
    endscript
}

[root@test001 log]# cat /etc/cron.daily/logrotate
#!/bin/sh

/usr/sbin/logrotate --force /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi

exit 0

No comments: