小编Hom*_*cIs的帖子

rsyslog没有设置group和everyone的读写权限

Rsyslog 忽略使用 fileCreateMode 为组和所有人设置的读写权限。

我已经设置了一个服务来运行我的节点应用程序,如下所示:

...
[Service]
WorkingDirectory=/opt/demo/app
User=appuser
Type=simple
ExecStart=/usr/bin/node myapp.js demo
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=myapp
...
Run Code Online (Sandbox Code Playgroud)

然后我在 /etc/rsyslog.d/ 中设置一个 myapp.conf 文件,如下所示

if ($programname == 'myapp') then {
    action(
        type="omfile"
        File="/opt/demo/app/app.log"
        fileCreateMode="0640"
        fileOwner="appuser"
        fileGroup="mygroup"
    )
    stop
}
Run Code Online (Sandbox Code Playgroud)

使用正确的用户和组创建日志文件,但权限为 0600 而不是 0640。

如果我将 fileCreateMode 更改为 0777,则文件将使用 0711 创建。

我使用默认的rsyslog.conf,rsyslog版本是8.24.0-41,操作系统是CentOS 7.7

rsyslogd -N 1不会抛出任何错误

syslog rsyslog centos7

3
推荐指数
1
解决办法
7103
查看次数

标签 统计

centos7 ×1

rsyslog ×1

syslog ×1