0

On my docker, i use amazonlinux:2 at this default enviroment not install cron.

I want to use logrotate for rotating log of application every daily. Can Logrotate work automatic without cron?

This file /etc/logrotate.d/app_log

/home/app/logs/*.log {
    daily
    compress
    maxage 7
    missingok
    notifempty
}
Zoredache
  • 130,897
  • 41
  • 276
  • 420
  • WHat is the problem to install `cron`? And who will create the schedule of logrotate (it there is no cron-like software)? – Romeo Ninov Jul 07 '22 at 14:36
  • @RomeoNinov I just want to know if logrotate can work independently without cron? i'm thinking it runs every day by cron at the directory /etc/cron.daily – VoVuong Jul 07 '22 at 14:48
  • 1
    I just remember there is such option in `systemd`, but please check this Q/A https://unix.stackexchange.com/q/278564/101265 – Romeo Ninov Jul 07 '22 at 14:51
  • 1
    @RomeoNinov Thank for answer. I thik i got the answer (It typically runs once a day via a cron job, and manages logs based on customized rules/settings from its config file.) https://www.vultr.com/docs/using-logrotate-to-manage-log-files/#:~:text=Logrotate%20is%20a%20Linux%20utility,and%20mailing%20of%20log%20files. – VoVuong Jul 07 '22 at 15:24

0 Answers0