I'm trying to use syslog with output channels to create some log files and I need them to have specific owners and permissions
Within the /etc/rsyslog I'm writing the following:
$umask 0027
$FileGroup the-mothers-of-invention
$outchannel rotate1,/path/mylog.log, 10000000,/path/my-rotate-script.sh /path mylog 99 .log 10000000
$template myTemplate,"%timegenerated:1:23:date-rfc3339%+%timegenerated:28:36:date-rfc3339% %syslogpriority-text:1:2:uppercase%hostname%:%msg%\n"
if $app-name == 'MYAPP' then {
*.* :omfile:$rotate1;myTemplate
stop
}
With this configuration, I see the first mylog.log file is created with permission 640 and groupID the-mothers-of-invention, but after reaching the 10mb, the script is correctly executed (I used the mv command) and I see the file mylog__.log is created and it inherits the owner and permissions from the original mylog.log file (so far, everything ok), but, when the new mylog.log file is automatically created by syslog, it is created with the default owner (root:root) and permissions (644).
I've been reading a lot of information & manuals (the rsyslog ones), but I don't see any information on combining the permissions change and the output channels.
Any guess?
Thanks!