Issue: logrotate is not rotating logs files
logrotate update below file, let's start with this file:
cat /var/lib/logrotate/status
logrotate state -- version 2 "/var/log/ufw.log" 2022-3-20-6:25:1 "/var/log/nginx/web_xxx.access.log" 2022-3-23-6:25:1 "/var/log/nginx/access.log" 2018-8-2-21:0:0 "/var/log/apt/history.log" 2021-11-8-6:25:1 "/var/log/user.log" 2022-3-23-6:0:0
We can see some of the logs are rotating but not all so let's run logrotate in debug mode and look for the error if any
sudo /usr/sbin/logrotate -d /etc/logrotate.conf
compressing log with: /bin/gzip renaming /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.2.gz to /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.3.gz (rotatecount 2, logstart 1, i 2), renaming /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.1.gz to /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.2.gz (rotatecount 2, logstart 1, i 1), renaming /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.0.gz to /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.1.gz (rotatecount 2, logstart 1, i 0), copying /home/deployer/apps/api_abc_co/shared/log/sidekiq.log to /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.1 truncating /home/deployer/apps/api_abc_co/shared/log/sidekiq.log removing old log /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.3.gz error: error opening /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.3.gz: No such file or directory
it's failing as it's unable to create a file. it's a bug. manually create a file and re-run logrotate in debug mode and fix all the errors.
This should resolve issue.