Using logrotate I am unable to get rotated file with user group and permissions that I need.

jstechg

New Member
Credits
35
On a machine with Ubuntu 16.0.4 I want to rotate daily the log file "/var/log/myapp.log"

I need the file that is obtained every day when rotating the log has 640 permissions and
belongs to the "root syslog" user/group.

The directory "/var/log" belongs to "root syslog".

I have created the configuration file "/etc/logrotate.d/myapp" with the content:

/var/log/myapp.log {
daily
rotate 7
copytruncate
notifempty
delaycompress
missingok
su root syslog
create 640 root syslog
compress
dateext
}

When executing the rotation of the log, it works correctly, except that the file that
generates logrotate belongs to user/group "root root" and has permissions 644.

I have consulted several tutorials, but I do not see what is wrong in the configuration file
above and because the file obtained does not belong to "root syslog" with 640 permissions.

Any help is welcome.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Top