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


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.

  • Probably also worth adding a feature request to make those settings configurable.
    – Lindsey D
    Jan 15 '16 at 17:49
  • Hmmm. Our craft log is like 300MB. Seems like the rotating isn't working correctly in our setup. Maybe it has to do with being on IIS. Jan 27 '16 at 20:24
  • Sounds like maybe a bug; Email support about that one. Jan 29 '16 at 17:05
  • I can confirm that another website on IIS has larger than 1MB log files. Aug 16 '16 at 15:12

Depending on what you want to do with the logs, if you're on a *nix server, logrotate is built into most systems.

Do something like:

/home/*user*/craft/storage/runtime/logs/*.log {



... which would rotate and gzip the logs after a week and append the date. There's a billion options in there including e-mailing you copies or moving them to different directories (like an archive). On Ubuntu/Debian, check out /etc/logrotate.d/ for examples.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.