Control Web Panel

WebPanel => Problems on other RedHat linux servers => Topic started by: gailclark80 on September 20, 2025, 01:07:45 AM

Title: Logrotate did not generate the rotated log file
Post by: gailclark80 on September 20, 2025, 01:07:45 AM
Logrotate did not generate the rotated log file.

My config
AlmaLinux 9.6
CWP 0.9.8.1216

Contents of File: /etc/logrotate.d/sample.com.log
/usr/local/apache/domlogs/sample.com.log
{
    missingok
    daily
    copytruncate
    rotate 7
    notifempty
}

However, this feature does not trigger automatically.
Manual triggering can generate new log files.

Why is this? How to automatically generate a new log file?
Title: Re: Logrotate did not generate the rotated log file
Post by: overseer on September 20, 2025, 11:54:16 AM
This is what I have for httpd logs, runs successfully on AlmaLinux 8 (as it did on CentOS 7 before):
Code: [Select]
/usr/local/apache/domlogs/*.log {
    missingok
    notifempty
    sharedscripts
    daily
    rotate 7
    postrotate
        /sbin/service httpd reload > /var/log/httpd-rotate.log 2>&1 || true
    endscript
    compress
}
Title: Re: Logrotate did not generate the rotated log file
Post by: gailclark80 on September 21, 2025, 12:09:30 AM
I checked the logrotate logs and found the following error:
error: error opening /usr/local/apache/domlogs/sample.com.log: Read-only file system

Then I checked the permissions and owner of this file. Its permissions are 644, and the owner is root. Both permissions and owner seem correct. Why is it still read-only?
Title: Re: Logrotate did not generate the rotated log file
Post by: rcschaff on September 21, 2025, 09:39:15 PM
What is the result of lsattr on the file?
Title: Re: Logrotate did not generate the rotated log file
Post by: gailclark80 on September 22, 2025, 12:02:19 AM
This is the result of the command.

Command:lsattr /usr/local/apache/domlogs/sample.com.log

Result: --------------e------- /usr/local/apache/domlogs/sample.com.log
Title: Re: Logrotate did not generate the rotated log file
Post by: rcschaff on September 22, 2025, 02:05:34 AM
Is selinux enabled or disabled on your server?  If it's enabled, it's probably your problem.