OCI- Logrotate is not working in Oracle Linux — Cloud Customer Connect
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register
Note!! Please register for a free account to access the full content and also to participate in Q&A in the community

OCI- Logrotate is not working in Oracle Linux

edited Jun 20, 2024 8:07AM in Linux

APPLIES TO:

Oracle Cloud Infrastructure

Linux OS 

SYMPTOMS

System logs aren't rotating weekly:

/var/log/messages
/var/log/boot
/var/log/secure

Exp : Expected result -rw-------. 1 root root 2110300 Jun 17 18:03 messages -rw-------. 1 root root 6157909 May 26 03:42 messages-20240526 -rw-------. 1 root root 7599326 Jun 2 03:30 messages-20240602 -rw-------. 1 root root 7963394 Jun 9 03:40 messages-20240609 -rw-------. 1 root root 8104750 Jun 16 03:06 messages-20240616 [root@XXXX ~]# grep logrotate /var/log/cron >>>>>Does not show any log recorded

Despite below settings are correct logrotate is not working

cat /etc/cron.daily/logrotate
#!/bin/sh
/usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0

# ls -la /etc/cron.daily/logrotate
-rwx------. 1 root root 219 Nov 21  2019 /etc/cron.daily/logrotate

# ls -la  /etc/logrotate.d/
drwxrwxrwx  2 root root     10  Sep  7 21:26 .
drwxrwxrwx 43 root root     86 Sep 7 21:26 .
-rwxrwxrwx  1 root root     91 Sep  7 21:26 bootlog
-rwxrwxrwx  1 root root 160 Sep 19  21:26 chrony
-rwxrwxrwx  1 root root 172 Sep 29 21:26 iscsiuiolog
-rwxrwxrwx  1 root root 224

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!