3

Using the following logrotate config file, rotated files are being chowned to the specified user but not compressed ones.

    /var/log/file.log {
           notifempty
            missingok
            size 1M
            rotate 30
            delaycompres
            create 0600 user group
            compress 
            }

Is this an expected behaviour from logrotate and if yes how can I tweak it to compress the logs with the correct permissions and user:group ?

pl1nk
  • 461
  • 5
  • 22

1 Answers1

2

'create' option tell logrotate to create new log file with specified permission before running postrotete script. It does not affect on permissions of compressed files. You may try this:

lastscript
chown user:group /var/log/yourapp/*.gz
chmod -R 0600 /var/log/yourapp/*.gz
endscript
Selivanov Pavel
  • 2,206
  • 3
  • 26
  • 48
  • So this is expected behaviour, I was hoping to not use custom scripts/commands inside logrotate configs. – pl1nk Mar 21 '13 at 16:02