logrotate cron job not rotating certain logs

后端 未结 6 985
生来不讨喜
生来不讨喜 2021-02-05 14:01

I added two scripts in \"logrotate.d\" directory for my application logs to be rotated. This is the config for one of them:

 {
  compress
           


        
6条回答
  •  庸人自扰
    2021-02-05 14:44

    SELinux was restricting the access to logrotate on log files in directories which does not have the required SELinux file context type. "/var/log" directory has "var_log_t" file context, and logrotate was able to do the needful. So the solution was to set this on my application log files and it's parent directory:

    semanage fcontext -a -t var_log_t 
    restorecon -v 
    

提交回复
热议问题