0

Good day!

I tried to use the logrotate facility of linux to rotate my tomcat logs. I created a script named tomcat under /etc/logrotate.d

/path/to/tomcat/catalina.out {
    missingok
    copytruncate
    daily
    rotate 10
    compress
    size 1M
}

Logrotate seems to be triggered daily via cron.daily but my tomcat logs are not rotated. I tried to execute the script manually by entering this command:

/usr/sbin/logrotate /etc/logrotate.conf

Surprisingly, it worked. Do you have any idea why cron job cannot rotate it? Below is the setup in crontab:

0 7 * * * root run-parts /etc/cron.daily

Thanks!

Oneb
  • 375
  • 1
  • 10
  • 21

1 Answers1

0

It seems like you need to add the following to /etc/cron.daily/logrotate: /usr/sbin/logrotate /etc/logrotate.conf Try running logrotate to verify: cd /etc/cron.daily/ && ./logrotate

LuckyLuc
  • 484
  • 1
  • 7
  • 21