Logs are only useful when you are looking at them, but without intervention they exist in our disk eating valuable space. You may just want to rotate them.

Ideally we want to, 1. Compress those logs 2. Remove really old ones 3. Have a sane way of expressing which logs get the above treatments and when
logrotate can do all this for you! Additionally it supports sending the logs via mail (but please don’t).
In alpine, you can easily install it with,
$ apk add logrotate
The nice thing about using a distribution like alpine is that, you can just install a service, and expect its logs to rotate automagically as long as logrotate is installed, as the packages are pre-configured by the package maintainers. Most of the time, all you need to do is, fine tune it to your own specific needs!
A sample /etc/logrotate.conf,
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new log files after rotating old ones
create
# Use date as a suffix for the rotated file
dateext
# compress log files
compress
# The individual files in this folder will be sourced here
include /etc/logrotate.d/
The above configuration applies to all log files, and we can fine tune individual services by specifying the log file path in the fashion of this sample configuration file /etc/logrotate.d/lighttpd that generates usage reports just before rotation,
/var/log/lighttpd/access.log
/var/log/lighttpd/error.log {
# we want daily rotation
daily
missingok
copytruncate
# overwrites the global value of 4 we set above
rotate 7
notifempty
sharedscripts
prerotate
# generate reports from lighttpd's access.log
goaccess-wrapper /tmp/goaccess-reports
endscript
postrotate
/etc/init.d/lighttpd --quiet --ifstarted reload
endscript
}
My system has the following log files and yours may vary depending on the services you run,
/etc/logrotate.d/
├── acct
├── acpid
├── chrony
├── lighttpd
├── openrc
├── proftpd
└── prosody
You may want to check out logrotate.conf man page that covers all the options you can specify to logrotate. Its a pretty light read.