Question:

Craft CMS Log Rotation

Kingston: 5 days ago

Does Craft have somewhere where I can setup log rotation for the craft.log file, or do admins have to manage that manually?

Answer:
Kai: 5 days ago

Craft will automatically 'rotate' logs into new files as each current file reaches the maximum size (~1MB).

This is why, if you look in /craft/storage/runtime/logs, you may see craft.log, craft.1.log, craft.2.log, etc.

(I think Craft keeps a max of 5 files around before rotating them off into the ether.)

At present, the max size, naming convention, and max log file count, are all not configurable. (To my great chagrin.)

If you want to rename/archive logs for your own purposes, you'll have to create your own workflow for that, either by scripting it and running it as a cron job, or by using a third-party aggregation/archival service such as Papertrail (https://papertrailapp.com/).