2017-03-24 14:40 GMT+01:00 Tomasz Chmielewski via rsyslog <rsyslog@lists.adiscon.com>: > I'm running rsyslog 8.16.0-1ubuntu3 on Ubuntu 16.04. > > I have $DirCreateMode set to 0755: > > root@log01:/# grep -i dircre /etc/rsyslog.conf > $DirCreateMode 0755 > > root@log01:/# grep -i dircre /etc/rsyslog.d/* > /etc/rsyslog.d/05-accept-remote.conf:$DirCreateMode 0755 > > > Unfortunately, directories automatically created (for data received from > remote hosts) by rsyslogd are still 0700. > > Did I use "$DirCreateMode 0755" in a wrong way? If not - how do I debug > this?
Old-Style directives ($DirCreateMode) by design only affect old-style constructs (/path/to/file). So the action() statment needs to have the mode setting. > > > If it matters - my template for accepting remote data is as below: > > template (name="RemoteMessage" type="string" string="%msg:2:$%\n") > template (name="mypath" type="string" > string="/var/log/remote/%$year%-%$month%-%$day%/%hostname%/%programname%") > if ($inputname == 'imtcp' or $inputname == 'imudp') then { > action(type="omfile" dynafile="mypath" template="RemoteMessage") > stop > } > > > Also tried adding dirCreateMode="0755" to the template, but it didn't help > and directories are still created with 0700 permissions: > > template (name="RemoteMessage" type="string" string="%msg:2:$%\n") > template (name="mypath" type="string" dirCreateMode="0755" > string="/var/log/remote/%$year%-%$month%-%$day%/%hostname%/%programname%") You should also get error messages from rsyslog, because this is nothing you can do inside a template. A template just creates a string, and that's it. So you need to apply the setting to the action in question... > if ($inputname == 'imtcp' or $inputname == 'imudp') then { > action(type="omfile" dynafile="mypath" template="RemoteMessage") action(type="omfile" dynafile="mypath" template="RemoteMessage" dirCreateMode="0755") > stop > } > see the example in the doc: http://www.rsyslog.com/doc/v8-stable/configuration/modules/omfile.html HTH Rainer > > Tomasz Chmielewski > https://lxadm.com > _______________________________________________ > 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. _______________________________________________ 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.