Files are not removing in logrotate script and permissions and user,group details are not updated

微笑、不失礼 提交于 2019-12-13 10:22:48

问题


Below are the challenges. Requesting your help on this.

  1. Files are not removing
  2. .gz files are not generated as per the user and group details given in the script.
  3. When I execute every time date extension is keep on adding to the same .gz files.
/var/log/httpd/access_log*        
/var/log/httpd/error_log*       
{      
    copytruncate
    daily      
    rotate 2
    compress
    missingok
    dateext
    maxage 5
    create 0644 hhh hhh
}   

回答1:


/var/log/httpd/access_log*    
/var/log/httpd/error_log*

Your wildcards are incorrect and catching literally everything in that directory, including the previously rotated files. The way you've defined it, logrotate is seeing the previously rotated files and treating them as new log files to start new rotations on, rather than old rotations of a previously-rotated log file. You need to tighten up your wildcards to something like this:

/var/log/httpd/*log


来源:https://stackoverflow.com/questions/56616953/files-are-not-removing-in-logrotate-script-and-permissions-and-user-group-detail

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!