Hi expert
I noticed that since April 5th on my Centos 7 server the logrotate process is not working.
The file /var/log/messages is 2.8GB in size. But it doesn't rotate daily. I searched many things but couldn't find why.
When I run the rotate process manually in debug mode, I get the following result.
Here it says rotate operation is required. But this process cannot be run on a daily basis.
What I don't understand is that while it was working properly, it suddenly stopped working.
I would be very grateful if you could help with this issue. Thanks in advance.
Logrotate is not working
Re: Logrotate is not working
No experience with logrotate, but I think I first would check
why the current file is very much bigger than the old ones.
why the current file is very much bigger than the old ones.
Re: Logrotate is not working
Well, it would be much bigger than the old ones because it hasn't rotated in more than a month
Is the cron entry that invokes logrotate still in place and running? Check /var/log/cron for entries showing if it ran and /etc/cron.daily for the presence of the logrotate file which should look something like
-rwx------. 1 root root 219 Apr 1 2020 logrotate
and whose contents should be
Is the cron entry that invokes logrotate still in place and running? Check /var/log/cron for entries showing if it ran and /etc/cron.daily for the presence of the logrotate file which should look something like
-rwx------. 1 root root 219 Apr 1 2020 logrotate
and whose contents should be
Code: Select all
#!/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
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
-
- Posts: 11
- Joined: 2022/03/31 06:37:43
Re: Logrotate is not working
Yes, I have checked these files before. The outputs are as follows: It's a really interesting situation. On some servers, the rotation process works fine, on others it does not.TrevorH wrote: ↑2022/05/10 15:59:37Well, it would be much bigger than the old ones because it hasn't rotated in more than a month
Is the cron entry that invokes logrotate still in place and running? Check /var/log/cron for entries showing if it ran and /etc/cron.daily for the presence of the logrotate file which should look something like
-rwx------. 1 root root 219 Apr 1 2020 logrotate
and whose contents should be
Code: Select all
#!/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
Re: Logrotate is not working
Check the output from aureport -a for events around the time that the logrotate cron job runs.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
-
- Posts: 11
- Joined: 2022/03/31 06:37:43
Re: Logrotate is not working
Hi I would like to share the solution in order to help others.
The problem is that the server we used before was RHEL6. In RHEL6, our /etc/logrotate.conf file was working fine when the permissions were 755. RHEL6 Machine
But after we migrated our servers to CentOS7, this build stopped working, so I did some research. And I found that the problem is that logrotate allows to run on CentOS7 only with 0644 and 0444 permissions. CENTOS7 Machine
As a result, Rhel6 can rotate with 755 permission, while Centos7 can only rotate with 644 and 444. If you try to rotate with another permission in Centos7 you will get this error: Thanks
The problem is that the server we used before was RHEL6. In RHEL6, our /etc/logrotate.conf file was working fine when the permissions were 755. RHEL6 Machine
But after we migrated our servers to CentOS7, this build stopped working, so I did some research. And I found that the problem is that logrotate allows to run on CentOS7 only with 0644 and 0444 permissions. CENTOS7 Machine
As a result, Rhel6 can rotate with 755 permission, while Centos7 can only rotate with 644 and 444. If you try to rotate with another permission in Centos7 you will get this error: Thanks