# Hard disk full - where to delete logs?

**URL:** <https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298>\
**Category:** Questions\
**Tags:** deployment\
**Created:** [September 11, 2020, 12:47am UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298 "2020-09-11T00:47:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Byron](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/byron/32/1839_2.png) [@Byron](https://community.n8n.io/u/Byron)\
**Post date:** [September 11, 2020, 12:47am UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/1 "2020-09-11T00:47:51Z")

</div>

Hi - great app, thank you all!

My hard drive is full and I can no longer save my workflow. I’m assuming it’s the buildup of n8n logs, since everything was working well for a while. Can you please point me to where the logs are saved, so I can delete some?

If it matters, I installed using npm, not docker.

Thank you so much!

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [September 11, 2020, 6:14am UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/2 "2020-09-11T06:14:52Z")

</div>

Welcome to the community @Byron and great to hear that you enjoy n8n!

Yes, it sounds like it. There are no log-files. The logs get saved in a database. So you would have to delete them there. The easiest way to do that and to also make sure that it does not get that far again in the future is to set some environment variables so that n8n automatically deletes old executions:

```bash
// Activates automatic data pruning
export EXECUTIONS_DATA_PRUNE=true
// Number of hours after execution when they should be deleted, by default 14 days
export EXECUTIONS_DATA_MAX_AGE=336

```

So if you set them and then restart n8n it should on startup run the first prune.

If you run n8n with SQLite, you will however see is that the disc-space will not be freed up. The reason for that is that SQLite does sadly not do that automatically. Therefore you have to VACUUM it manually. An example, how to do that can be found here:

> <https://stackoverflow.com/questions/18126997/how-to-vacuum-sqlite-database>

The SQLite file you will find under this location: `~/.n8n/database.sqlite`

---

<div class="post-metadata">

**Author:** ![Byron](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/byron/32/1839_2.png) [@Byron](https://community.n8n.io/u/Byron)\
**Post date:** [September 11, 2020, 3:48pm UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/3 "2020-09-11T15:48:18Z")

</div>

Thanks Jan for the response!

I couldn’t get the SQLite VACUUM to work. I was able to resolve by increasing the size of my EC2 EBS Volume though.

Would you generally just recommend using Postgres or some other database that doesn’t have this issue then, if the VACUUM needs to be manual anyway? Perhaps an external database?

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [September 11, 2020, 5:39pm UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/4 "2020-09-11T17:39:21Z")

</div>

Running with SQLite is totally fine. If you make sure that old executions get cleaned up automatically (as described above) you should not have that problem again as it then simply reuses the freed up space in the file. The only thing is really that the file does not reduce in size until you run vacuum.

---

<div class="post-metadata">

**Author:** ![huuich](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/huuich/32/1115_2.png) [@huuich](https://community.n8n.io/u/huuich)\
**Post date:** [October 31, 2020, 3:27am UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/5 "2020-10-31T03:27:07Z")

</div>

@jan if running n8n on docker, how to make old executions get cleaned up automatically?

---

<div class="post-metadata">

**Author:** ![Miquel\_Colomer](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/miquel_colomer/32/18606_2.png) [@Miquel\_Colomer](https://community.n8n.io/u/Miquel_Colomer)\
**Post date:** [October 31, 2020, 7:47am UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/6 "2020-10-31T07:47:46Z")

</div>

If you work with Mysql, data is stored in a table.

Perhaps this workflow would be useful to prune executions history from a workflow instead of restarting n8n:

> **[Purge n8n execution history located in Mysql | n8n workflow template](https://n8n.io/workflows/700-purge-n8n-execution-history-located-in-mysql/)**
>
> This workflow is useful if you have lots of tasks running daily. MySQL node (or the database used to save data shown in n8n - could be Mongo, Postgres, ......

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [October 31, 2020, 8:16am UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/7 "2020-10-31T08:16:46Z")

</div>

Thanks a lot @Miquel_Colomer!

You can also set up n8n to automatically delete old executions as documented here:

> **[Configuration | n8n Docs](https://docs.n8n.io/getting-started/installation/advanced/configuration.html)**
>
> n8n is an extendable workflow automation tool that enables you to connect anything to everything via its open, fair-code model.

If you are using SQLite also an interesting GitHub issue here:  
[https://github.com/n8n-io/n8n/issues/1111](https://github.com/n8n-io/n8n/issues/1111)

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [October 31, 2020, 8:17am UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/8 "2020-10-31T08:17:37Z")

</div>

Actually just saw that it got already mentioned above. So do then not really understand the question I guess.

---

<div class="post-metadata">

**Author:** ![huuich](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/huuich/32/1115_2.png) [@huuich](https://community.n8n.io/u/huuich)\
**Post date:** [October 31, 2020, 8:18am UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/9 "2020-10-31T08:18:28Z")

</div>

Thank you, so I install n8n by default docker follow instruction [Introduction | Docs](https://docs.n8n.io/#/server-setup) and database is SQLite. How can I change to Mysql?

---

<div class="post-metadata">

**Author:** ![huuich](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/huuich/32/1115_2.png) [@huuich](https://community.n8n.io/u/huuich)\
**Post date:** [October 31, 2020, 8:24am UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/10 "2020-10-31T08:24:03Z")

</div>

@jan I’ve install n8n by default docker follow instruction [Introduction | Docs](https://docs.n8n.io/#/server-setup), so seem this instruction [Configuration | Docs](https://docs.n8n.io/reference/configuration.html#prune-data) not working, I’ve type 2 command to server:  
export EXECUTIONS\_DATA\_PRUNE=true

export EXECUTIONS\_DATA\_MAX\_AGE=336

And restart server, but my database increase day by day! And executions over 14 days still exist.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [October 31, 2020, 9:10am UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/11 "2020-10-31T09:10:22Z")

</div>

If you run n8n inside of Docker and you set the environment variables on the server instead that will not work. Docker handles everything totally independently. You have to add them to the `environment` section of the `docker-compose.yml` file. So something like:

```nohighlight
...
    environment:
      - EXECUTIONS_DATA_PRUNE=true
      - EXECUTIONS_DATA_MAX_AGE=336
...

```

That will automatically delete old executions older than 336 h. But as mentioned in the above GitHub issue will the file size of the database-file not shrink unless you manually `vacuum` it.

---

<div class="post-metadata">

**Author:** ![huuich](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/huuich/32/1115_2.png) [@huuich](https://community.n8n.io/u/huuich)\
**Post date:** [October 31, 2020, 9:35am UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/12 "2020-10-31T09:35:23Z")

</div>

@jan Thank you so much, add command to the `environment` section of the `docker-compose.yml` file is the solution, I can Vacuum my sqlite database now.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [October 31, 2020, 9:45am UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/13 "2020-10-31T09:45:15Z")

</div>

Perfect! Now it should never grow that large again.

Have fun!

---

<div class="post-metadata">

**Author:** ![Surge.Media](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@Surge.Media](https://community.n8n.io/u/Surge.Media)\
**Post date:** [July 11, 2022, 3:02pm UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/14 "2022-07-11T15:02:00Z")

</div>

This post saved me, if I wanted to move the database.sqlite to an external hard disk (mounted) would it be enough to just move to database and add into the environment

```auto
N8N_USER_FOLDER=/mnt/mydrive/database.sqlite

```

or would i need to move all the contents of the n8n directory to this new drive

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [July 11, 2022, 3:09pm UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/15 "2022-07-11T15:09:08Z")

</div>

Hi @Surge.Media, `N8N_USER_FOLDER` specifies a folder rather than a database file. n8n would look (or create) an `.n8n` folder inside the location specified through `N8N_USER_FOLDER`. So you’d most likely want to copy the `.n8n` folder from your home directory to your new drive.

---

<div class="post-metadata">

**Author:** ![\_Alexy](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/_alexy/32/17041_2.png) [@\_Alexy](https://community.n8n.io/u/_Alexy)\
**Post date:** [October 27, 2022, 3:22pm UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/16 "2022-10-27T15:22:09Z")

</div>

Make a VACCUM on database.sqlite is safe ?

I mean, all the workflown, credentials etc are not stored in this database ? There are only logs ?

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [November 2, 2022, 11:19am UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/17 "2022-11-02T11:19:05Z")

</div>

Hey @_Alexy, this operation isn’t particularly problematic, though it does require quite a bit of disk space (since it essentially creates a new copy of the database before the old one is deleted). That said, taking a backup beforehand is always a good idea because things can always go wrong. Your database would not only contain execution data but also your workflows and credentials. So, you might want to export them beforehand [as described here](https://docs.n8n.io/reference/cli-commands/#export-workflows-and-credentials) just to be on the safe side.

---

<div class="post-metadata">

**Author:** ![Luca\_O](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/luca_o/32/23330_2.png) [@Luca\_O](https://community.n8n.io/u/Luca_O)\
**Post date:** [March 14, 2023, 10:31am UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/18 "2023-03-14T10:31:20Z")

</div>

Hi, we put EXECUTIONS\_DATA\_PRUNE and EXECUTIONS\_DATA\_MAX\_AGE in our n8n v 0.44.0 but we get the error:  
EXECUTIONS\_DATA\_MAX\_AGE=4320  
^^^^^^^^^^^^^^^^^^^^^^^  
SyntaxError: Unexpected identifier

Are that variables available in n8n v 0.44?

thank you  
Luca

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [March 14, 2023, 12:21pm UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/19 "2023-03-14T12:21:05Z")

</div>

Hey @Luca_O,

Welcome to the community 🙌

Just to confirm are you really running `0.44.0` or is it `0.144.0`? How are you setting the variable as well?

---

<div class="post-metadata">

**Author:** ![Vadorequest](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/vadorequest/32/19837_2.png) [@Vadorequest](https://community.n8n.io/u/Vadorequest)\
**Post date:** [June 28, 2024, 9:14pm UTC](https://community.n8n.io/t/hard-disk-full-where-to-delete-logs/2298/20 "2024-06-28T21:14:53Z")

</div>

I ran into the same issue today (using Cloudron to manage n8n).

Setting

```auto
export EXECUTIONS_DATA_PRUNE=true
export EXECUTIONS_DATA_MAX_AGE=1

```

But it failed to prune.

> <https://gist.github.com/Vadorequest/9e16a84422341b96b64cd874e3d7868c>

I’m discussing it with Cloudron there, in case it would be Cloudron-related

> **[40GB Disk full with a single app - n8n](https://forum.cloudron.io/topic/12000/40gb-disk-full-with-a-single-app-n8n/2)**
>
> I noticed my Cloudron instance has its disk full (40GB). Due to the lack of space, I can't make a Cloudron backup before doing things. I did a Hetzner Snapsh...
