Interview Prep/Linux/Logs, Limits & High-Traffic Tuning

Write a logrotate config for an application log.

BeginnerProductionLogs, Limits & High-Traffic Tuning
Answer
# /etc/logrotate.d/orders-api
/var/log/orders-api/*.log {
    daily
    rotate 14
    maxsize 500M
    compress
    delaycompress
    missingok
    notifempty
    create 0640 api adm
    sharedscripts
    postrotate
        systemctl kill -s USR1 orders-api.service >/dev/null 2>&1 || true
    endscript
}
sudo logrotate -d /etc/logrotate.d/orders-api   # dry run
sudo logrotate -f /etc/logrotate.d/orders-api   # force
All Linux questions Roadmap: Linux

More on Logs, Limits & High-Traffic Tuning