Archiving Looker log files

Looker automatically rotates log files daily. However, once the log is rotated and date stamped, Looker does not perform any further actions to compress or delete the logs. To preserve disk space on a customer-hosted Looker instance, we recommend you archive and delete older log files.

For the most basic configuration, we recommend setting up archive jobs in the Looker user's crontab. Add the following cron entries to leave the previous 7 days of log files uncompressed and the 21 days of log files prior to that gzipped in your log directory:

##zip Looker logs
9 1 * * * find $HOME/looker/log -name 'looker.log.????????' -mtime +7 -exec gzip '{}' \; > /dev/null
##delete Looker logs
33 1 * * * find $HOME/looker/log -name 'looker.log.????????.gz' -mtime +28 -exec rm -f '{}' \; > /dev/null

To leave fewer uncompressed logs, change the 7 in the first entry to a lower number. To store fewer compressed logs, change the 28 in the second crontab entry to a lower number.

For more information on how to use cron, see https://help.ubuntu.com/community/CronHowto.