# Lack of Log Rotation Configuration in Ghost Server Can Eventually Consume All Disk Space

**URL:** <https://forum.ghost.org/t/lack-of-log-rotation-configuration-in-ghost-server-can-eventually-consume-all-disk-space/20618>\
**Category:** Using Ghost\
**Created:** [March 8, 2021, 3:25pm UTC](https://forum.ghost.org/t/lack-of-log-rotation-configuration-in-ghost-server-can-eventually-consume-all-disk-space/20618 "2021-03-08T15:25:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Torqu3Wr3nch](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/torqu3wr3nch/32/11937_2.png) [@Torqu3Wr3nch](https://forum.ghost.org/u/Torqu3Wr3nch)\
**Post date:** [March 8, 2021, 3:25pm UTC](https://forum.ghost.org/t/lack-of-log-rotation-configuration-in-ghost-server-can-eventually-consume-all-disk-space/20618/1 "2021-03-08T15:25:38Z")

</div>

Hi everyone,

Just wanted to share with the community something I noticed last week while I was [backing up my Ghost content’s folder with rsync](https://engineerworkshop.com/blog/backup-your-ghost-content-to-unraid/). `rsync` would hang as it moved the logs directory; looking further into it, my Ghost access log had grown to several gigabytes and was continuing to grow.

Ultimately the cause is the lack of a `logrotate` configuration for the Ghost logs. After troubleshooting and testing my config this weekend, I am comfortable enough releasing it to the community. Hopefully this helps someone else out:

> **[Save Disk Space By Setting Up Logrotate with Your Ghost Blog](https://engineerworkshop.com/blog/save-your-disk-space-by-setting-up-logrotate-for-your-ghost-cms/)**
>
> The Ghost blog platform doesn't automatically set up logrotation when it is installed. As a result, Ghost will perpetually append to its log files until you run out of disk space. Here is how to fix it using the logrotate utility in Linux.

**Note that this is only a concern for self-hosted instances of Ghost.**

-TorqueWrench

---

<div class="post-metadata">

**Author:** ![Hannah](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hannah/32/22_2.png) [@Hannah](https://forum.ghost.org/u/Hannah)\
**Post date:** [March 8, 2021, 5:01pm UTC](https://forum.ghost.org/t/lack-of-log-rotation-configuration-in-ghost-server-can-eventually-consume-all-disk-space/20618/2 "2021-03-08T17:01:56Z")

</div>

Ghost’s default log rotation configuration should rotate your logs every day and keep just 10 logs.

So it sounds like you ran into either a bug or an environment issue. Maybe you can share how you installed Ghost?

We certainly expect that Ghost would not fill up your disk with logs.

---

<div class="post-metadata">

**Author:** ![Torqu3Wr3nch](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/torqu3wr3nch/32/11937_2.png) [@Torqu3Wr3nch](https://forum.ghost.org/u/Torqu3Wr3nch)\
**Post date:** [March 8, 2021, 5:59pm UTC](https://forum.ghost.org/t/lack-of-log-rotation-configuration-in-ghost-server-can-eventually-consume-all-disk-space/20618/3 "2021-03-08T17:59:22Z")

</div>

Hi Hannah,

Glad to hear that! I don’t really see it as a problem with Ghost per se; logrotate is a standard utility that most Linux sysadmins would be aware of that might need configuration with the installation of a new application. The only reason I brought it up to the community is that others may not be aware.

Looks like I’m not the first person to notice this, someone else reported it here back in October:

> [@Production log file size](https://forum.ghost.org/t/production-log-file-size/17858):
>
> The production log file has reached a size of almost 5gb, is this normal or is there something wrong? Older production log files are considerably smaller. Such a large file is difficult to manage [Cattura]

Install process was about 1.5-2 yrs ago using the following guide for Ubuntu:

> **[How to install & setup Ghost on Ubuntu 20.04 or 22.04](https://ghost.org/docs/install/ubuntu/)**
>
> A full production install guide for how to install the Ghost professional publishing platform on a production server running Ubuntu 20.04 or 22.04.

All defaults used, running Ubuntu 18.04 LTS with regular, weekly Ghost updates.

`head -1` indicates the access log in /var/www/ghost/content/logs/ goes back to June 2020.

---

<div class="post-metadata">

**Author:** ![Torqu3Wr3nch](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/torqu3wr3nch/32/11937_2.png) [@Torqu3Wr3nch](https://forum.ghost.org/u/Torqu3Wr3nch)\
**Post date:** [March 8, 2021, 6:18pm UTC](https://forum.ghost.org/t/lack-of-log-rotation-configuration-in-ghost-server-can-eventually-consume-all-disk-space/20618/4 "2021-03-08T18:18:54Z")

</div>

@Hannah

Looking further at the other report of this issue:

> [@Production log file size](https://forum.ghost.org/t/production-log-file-size/17858/3):
>
> this is the date in the first line of the file time":"2020-06-03T00:00:15.288Z I have not changed anything in the server, definitely not from this date on, theoretically everything should be configured the same way as when I started, I have not changed much in the server except something in terms of firewall and security I’m not sure if I should check the logorate tool, but the content looks correct: # see "man logrotate" for details # rotate log files weekly weekly # use the syslog group by…

> [@Production log file size](https://forum.ghost.org/t/production-log-file-size/17858/3):
>
> this is the date in the first line of the file `time":"2020-06-03T00:00:15.288Z`

Now this is interesting. We have almost the exact same date (maybe I just updated a day later). Seems like an oddly strange coincidence, doesn’t it? Within a day of each other in June almost a year ago:

“time”:“2020-06-04T00:01:11.425Z”

---

<div class="post-metadata">

**Author:** ![giacomosilli](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/giacomosilli/32/3403_2.png) [@giacomosilli](https://forum.ghost.org/u/giacomosilli)\
**Post date:** [March 9, 2021, 7:04pm UTC](https://forum.ghost.org/t/lack-of-log-rotation-configuration-in-ghost-server-can-eventually-consume-all-disk-space/20618/5 "2021-03-09T19:04:36Z")

</div>

surely something has changed, probably a package upgrade or Ubuntu upgrade. I haven’t changed anything manually.

I also followed the official installation of Ghost on a clean server

---

<div class="post-metadata">

**Author:** ![rajiin](https://avatars.discourse-cdn.com/v4/letter/r/97f17d/32.png) [@rajiin](https://forum.ghost.org/u/rajiin)\
**Post date:** [March 15, 2021, 11:15am UTC](https://forum.ghost.org/t/lack-of-log-rotation-configuration-in-ghost-server-can-eventually-consume-all-disk-space/20618/6 "2021-03-15T11:15:17Z")

</div>

mine starts at 2020-06-06T00:00:43.515Z, there is rotated logs in the folder but they stopped on june 6th

followed the same guide

---

<div class="post-metadata">

**Author:** ![Torqu3Wr3nch](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/torqu3wr3nch/32/11937_2.png) [@Torqu3Wr3nch](https://forum.ghost.org/u/Torqu3Wr3nch)\
**Post date:** [March 15, 2021, 6:35pm UTC](https://forum.ghost.org/t/lack-of-log-rotation-configuration-in-ghost-server-can-eventually-consume-all-disk-space/20618/7 "2021-03-15T18:35:54Z")

</div>

Thanks for the additional datapoint, @rajiin. So we’re all in the same boat!

I wonder how many people are heading for a full storage drive and don’t even know it…

---

<div class="post-metadata">

**Author:** ![Hal](https://avatars.discourse-cdn.com/v4/letter/h/ee7513/32.png) [@Hal](https://forum.ghost.org/u/Hal)\
**Post date:** [September 2, 2021, 5:28pm UTC](https://forum.ghost.org/t/lack-of-log-rotation-configuration-in-ghost-server-can-eventually-consume-all-disk-space/20618/8 "2021-09-02T17:28:01Z")

</div>

I just experienced the log rotate issue and solved it using @Torqu3Wr3nch’s article: [Save Disk Space By Setting Up Logrotate with Your Ghost Blog](https://engineerworkshop.com/blog/save-your-disk-space-by-setting-up-logrotate-for-your-ghost-cms/). Thank you @Torqu3Wr3nch ! I was up to 90% usage on my 25 GB space. Now I’m back to something reasonable, thanks to your help here.

---

<div class="post-metadata">

**Author:** ![tmack](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/tmack/32/294_2.png) [@tmack](https://forum.ghost.org/u/tmack)\
**Post date:** [October 12, 2022, 3:41pm UTC](https://forum.ghost.org/t/lack-of-log-rotation-configuration-in-ghost-server-can-eventually-consume-all-disk-space/20618/9 "2022-10-12T15:41:24Z")

</div>

I have experienced something similar, but relating to insufficient permissions erroring out in logrotate.

I’ve added the `su` directive to the logrotate.d/ghost configuration file that now looks like this due to errors that were being output when testing logrotate manually with debug logging.

```auto
considering log /var/www/<domain>/content/logs/https___<domain>_production.log
error: skipping "/var/www/<domain>/content/logs/https___<domain>_production.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.

```

more /etc/logrotate.d/ghost

```auto
/var/www/*/content/logs/*.log {
        daily
        maxsize 400M
        notifempty
        rotate 7
        compress
        copytruncate
        su ghost ghost
}

I added `notifempty`, `su ghost ghost` and modified the number of log files to keep around and to rotate daily or at a specific `maxsize` (as file system sizes aren't a function of days/weeks/months but rather size).

```

---

<div class="post-metadata">

**Author:** ![Praveen\_Kumar\_Singh](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/praveen_kumar_singh/32/40099_2.png) [@Praveen\_Kumar\_Singh](https://forum.ghost.org/u/Praveen_Kumar_Singh)\
**Post date:** [April 3, 2026, 10:35am UTC](https://forum.ghost.org/t/lack-of-log-rotation-configuration-in-ghost-server-can-eventually-consume-all-disk-space/20618/10 "2026-04-03T10:35:30Z")

</div>

**Hey everyone,**

I just wanted to chime in because my team experienced this _exact_ same issue recently. During a massive traffic spike on our Ghost site, the log files grew drastically high over a short period. Since standard rotation is purely time-based (e.g., waiting 1 day to rotate), the file had plenty of time to indiscriminately consume our infrastructure until the site crashed entirely with a `no space left on device` error.

It was frustrating enough that we actually dug into the Ghost framework’s core codebase to see why we couldn’t just restrict the file size limit inside `config.production.json`.

**Here’s what we found to fix it:** Ghost _does_ actually possess an incredibly robust log rotating engine natively (`bunyan-rotating-filestream`) that supports strict size-limits and gzip compression! However, it was completely hidden in the background, making it impossible for server admins to natively access these capabilities via regular defaults.

To solve this for all of us, we just created a Pull Request that formally exposes these advanced parameters to the default file structure. Once merged, any admin can securely cap their logs _by size_ and enable compression, like this:

```json
{

"logging": {

"rotation": {

"threshold": "50m",

"gzip": true

    }

  }

}

```

With this, Ghost will actively monitor the log size and instantly compress and rotate it the moment it hits `50m`, fully preventing the disk-space bloat crashes.

If this has been a major pain point for you as well, it would be awesome if you could support/review the PR over on GitHub to help us get it merged into core faster!

**🔗 You can check out the Pull Request here:** [https://github.com/TryGhost/Ghost/pull/27107](https://github.com/TryGhost/Ghost/pull/27107)

Hopefully, this permanently resolves the log nightmares for high-traffic sites
