Search code examples
linuxamazon-web-servicescronaws-opsworkslogrotate

AWS Opsworks: logrotate it runs automatically?


I have configured my own logrotate(app logs) and for editing(nginx logs), all created in a recipes(chef). My question is: logrotate it runs automatically?

I ask because I have configurations in which the logs can not EXCEED 5MB in size, and have logs with sizes of 100MB.

show crontabs for root:

crontab -l
no crontab for root

/etc/logrotate.conf

weekly
su root syslog
rotate 4
create
include /etc/logrotate.d
/var/log/wtmp {
    missingok
    monthly
    create 0664 root utmp
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0660 root utmp
    rotate 1
}

Solution

  • Usually, logrotate is run as a daily cron job. You could add size 5M and daily to the logrotate config for the logs you're interested in.

    There would be the potential for the log to grow past 5M between daily logrotate runs. This could be tuned by lowering the size value and/or running logrotate more often.

    Check man logrotate for more details.