首页 > 解决方案 > UWSGI 日志轮换出现错误:“父目录具有不安全的权限”

问题描述

我想轮换 UWSGI 的日志,这是我的配置文件:

/var/log/uwsgi.log {
        size 100M
        missingok
        rotate 400
        dateext
        dateformat .%Y%m%d-%s
        compress
        notifempty
        create
        sharedscripts
        postrotate
           stop uwsgi
           start uwsgi
        endscript
}

但是当我尝试旋转它时出现以下错误:

error: skipping "/var/log/uwsgi.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.

该文件的权限如下:

-rw-r----- 1 root root 33201346 Oct 10 10:32 /var/log/uwsgi.log
-rw-r--r-- 1 root root 281 Oct 10 10:20 /etc/logrotate.d/uwsgi

所以我看不出有任何理由使用“su”指令。谁能告诉我这里有什么问题?我也不确定每次旋转日志时是否需要重新启动它(我从这里借用它)。并且我的配置文件看起来与这些示例相同(1除了创建权限,我不确定它是否重要)、2、3 除了 postrotate)、5(我不使用复制截断,作为日志文件很大),6这些解决方案都没有权限问题。

标签: permissionsuwsgilogrotate

解决方案


尝试确保父目录具有正确的权限

chmod 755 /var/log/ && chown root:root /var/log/
chmod 755 /var && chown root:root /var

您可能应该尝试将配置文件中的创建权限设置为类似

create 777 root root

如果以上都不起作用su root syslog,请在配置中使用


推荐阅读