0

I am trying to logrotate my log files. Here is my configuration file:

/home/deploy/apps/production_app/current/log/*.log {
    daily
    missingok
    rotate 52
    compress
    create 0644 deploy deploy
    delaycompress
    notifempty
    sharedscripts
    copytruncate
}

And this is result of

ll apps/production_app/current/log/

on my log files:

-rw-rw-r-- 1 deploy deploy        0 Jul  1 10:01 production.log
-rw-rw-r-- 1 deploy deploy  1124555 Jul  1 10:01 production.log.1

And when I run this command

logrotate -v /etc/logrotate.d/production_app

I get following:

error: error creating output file /var/lib/logrotate.status.tmp: Permission denied

And here is permission on my log-rotate config file

lrwxrwxrwx 1 root root 67 Feb 25  2019 /etc/logrotate.d/production_app -> /home/deploy/apps/production_app/shared/config/log_rotation
Zia Qamar
  • 1,694
  • 1
  • 15
  • 35

1 Answers1

0

please check whether the dir "var/lib" is readonly.

Jason_AnN
  • 99
  • 1
  • 4
  • ll /var/ => drwxr-xr-x. 28 root root – Zia Qamar Jul 01 '20 at 06:00
  • maybe it is same with this issue. please refers it. in addition, you should add sudo. https://stackoverflow.com/questions/10761495/error-error-creating-state-file-var-lib-logrotate-status-permission-denied – Jason_AnN Jul 01 '20 at 06:32