This is a umask problem, you needc to change your system to set teh umask to something you consider sane (since you are explicitly setting permission, I would set it to 000)

David Lang

On Wed, 4 Dec 2019, Ángel L. Mateo via rsyslog wrote:

Date: Wed, 4 Dec 2019 14:07:54 +0100
From: Ángel L. Mateo via rsyslog <[email protected]>
To: rsyslog-users <[email protected]>
Cc: Ángel L. Mateo <[email protected]>
Subject: [rsyslog] problem with dircreatemode and filecreatemode

Hello,

        I have a problem with files created with omfile module.

        I have this config:

# Fichero por defecto para guardar el log
template(name="default_output_file" type="string" string="/logs/local/%$!hostname%/%$year%/%$month%/%$day%/%$!filename%")

ruleset(name="save_to_file"
) {
  action(type="omfile"
    name="save_to_file"
    dirCreateMode="0755"
    fileCreateMode="0640"
    dynaFile="default_output_file"
    template="defaultOutputFormat"
  )
}

# Solo para probar
$RuleSet remote_udp
        if $hostname == 'canis40' then {
                set $!hostname = 'ldapacc.um.es' ;
                set $!filename = 'ldap.log' ;
        }
        call save_to_file

$RuleSet RSYSLOG_DefaultRuleset

With this config logs from this host should be written to /logs/local/ldapacc.um.es/2019/12/04/ldap.log and they are written to this file.

        The problem is that the file is created with perms 0711:

amateo_adm@pitufo30:/etc/rsyslog.d$ ls -l /logs/local/
total 1
drwx--x--x 3 syslog adm 3 dic  4 13:59 ldapacc.um.es

        and file with perms 0600.

If I stop the rsyslog service and run it with "sudo rsyslogd -nd" then files are correctly created.

But I have found that when rsyslog is run from service, it has umask 0066 and when I run it manually it has 0022. This is the only difference I have found, although I guess that if a mode is specified in the config file, then umask shouldn't be used.

I have rsyslog 8.1911.0 (installed from adiscon repositories) in a ubuntu 18.04. This same config in a ubuntu 14.04 with rsyslog 8.25 is creating files correctly.

        Any help?


_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to