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

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

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

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

<p>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 <a href="https://papertrailapp.com/" rel="nofollow"><em>Papertrail</em></a>.</p>

CC BY-SA 3.0
2016-01-15T17:49:30.097Z
Probably also worth adding a [feature request](http://feedback.craftcms.com/) to make those settings configurable.
Lindsey D
CC BY-SA 3.0
2016-01-27T20:24:38.507Z
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.
Davin Studer
CC BY-SA 3.0
2016-01-29T17:05:24.313Z
Sounds like maybe a bug; Email support about that one.
Michael Rog
CC BY-SA 3.0
2016-08-16T15:12:48.413Z
I can confirm that another website on IIS has larger than 1MB log files.
Ben Parizek
CC BY-SA 3.0
2016-01-15T17:31:47.900Z
2016-01-15T17:31:47.900Z
Michael Rog
<p>Depending on what you want to do with the logs, if you're on a *nix server, <a href="http://www.linuxcommand.org/man_pages/logrotate8.html" rel="nofollow">logrotate</a> is built into most systems.   </p>

<p>Do something like:</p>

<pre><code>/home/*user*/craft/storage/runtime/logs/*.log {

  weekly
  dateext
  compress
  delaycompress
  notifempty
</code></pre>

<p>}</p>

<p>... 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 <code>/etc/logrotate.d/</code> for examples.</p>

CC BY-SA 3.0
2016-01-15T20:07:37.410Z
2016-01-15T20:07:37.410Z
RitterKnight
<p>Does Craft have somewhere where I can setup log rotation for the craft.log file, or do admins have to manage that manually?</p>

<admin><logs>
Craft CMS Log Rotation
# Craft CMS Log Rotation

(Asked by: username_0 on 2016-01-15)

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

**Tags:** admin, logs


---

## 2 answers

### Answer by username_1 on 2016-01-15. Score: 4

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/).

> **Comments:**
> **username_2**: Probably also worth adding a [feature request](http://feedback.craftcms.com/) to make those settings configurable.  
> **username_0**: 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.  
> **username_1**: Sounds like maybe a bug; Email support about that one.  
> **username_3**: I can confirm that another website on IIS has larger than 1MB log files.  

---

### Answer by username_4 on 2016-01-15. Score: 1

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 {

  weekly
  dateext
  compress
  delaycompress
  notifempty

}
... 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.


---

