Logrotate日志切割报错 文件不再同一个用户组下

来源:互联网 发布:js new date(s) 编辑:程序博客网 时间:2024/05/21 07:00

分割日志时报错:

error: skipping "/var/log/nginx/test.access.log" because parentdirectory has insecure permissions (It's world writable or writable bygroup which is not "root") Set "su" directive in config file to telllogrotate which user/group should be used for rotation.

xx 文件所属用户

添加“su root xx”到/etc/logrotate.d/nginx文件中即可
如下;

/var/log/nginx/*.log {        su root public        daily        missingok        rotate 52        compress        delaycompress        notifempty        #ifempty        create 0640 www-data adm        sharedscripts        postrotate                [ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`        endscript}
原创粉丝点击