After creating a custom log configuration for my app by adding myapp.conf into the /etc/rsyslog.d/ folder with the contents listed below:
if ( $programme contains "myapp" ) then {
action(type="omfile" file="/appl/logs/myapp.lo" FileOwner="myappowner" FileGroup="myappgroup" FileCreateMode="0644")
}
I went on creating a logrotate config as follows:
/appl/logs/myapp.log {
su myappowner myappgroup
rotate 10
maxsize 50M
monthly
missingok
compress
}
The logs are being created as expected but when I try to debug the newly created logrotate configuration with logrotate -d /etc/logrotate.d/myapp
I get:
error: stat of /appl/logs/myapp.log failed: Permission denied
The /appl/logs/ folder is owned by the myappownder and myappgroup and the /appl/logs/myapp.log file has 644 permissions.