I added two scripts in \"logrotate.d\" directory for my application logs to be rotated. This is the config for one of them:
{
compress
I had a similar problem. To resolve this, I first checked the status of SELinux using the sestatus command:
# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 24
Policy from config file: targeted
Then, check the SELinux security context applied to files and directories using ls --scontext. Check the files you want logrotate to operate on, and check files that are working, such as /var/log/maillog:
# ls --scontext /var/log/maillog*
system_u:object_r:var_log_t:s0 /var/log/maillog
system_u:object_r:var_log_t:s0 /var/log/maillog-20140713
system_u:object_r:var_log_t:s0 /var/log/maillog-20140720
system_u:object_r:var_log_t:s0 /var/log/maillog-20140727
system_u:object_r:var_log_t:s0 /var/log/maillog-20140803
Use semanage to change the file context.
semanage fcontext -a -t var_log_t
restorecon -v