0

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.

Cat Hariss
  • 123
  • 10
  • is selinux enabled? Use `getenforce`. If enabled, this might be the problem. https://www.mysysadmintips.com/linux/servers/587-find-if-permission-denied-error-is-caused-by-selinux – GoinOff Dec 02 '22 at 16:11
  • `su` is a user, not a permission. Does [logrotate says permission denied](https://stackoverflow.com/a/6208191/7558856) answer your question? – eDonkey Dec 05 '22 at 16:04

0 Answers0