# Output supervisor logs (journalctl) to a file

**URL:** <https://forums.balena.io/t/output-supervisor-logs-journalctl-to-a-file/20807>\
**Category:** balenaOS\
**Tags:** support\
**Created:** [July 17, 2019, 9:34pm UTC](https://forums.balena.io/t/output-supervisor-logs-journalctl-to-a-file/20807 "2019-07-17T21:34:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rossm](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@rossm](https://forums.balena.io/u/rossm)\
**Post date:** [July 17, 2019, 9:34pm UTC](https://forums.balena.io/t/output-supervisor-logs-journalctl-to-a-file/20807/1 "2019-07-17T21:34:12Z")

</div>

Has anyone found a way to write the journalctl logs to a file? The logs on my system only keeps ~8M of data and writing them to a file would be very useful for debugging.

---

<div class="post-metadata">

**Author:** ![xginn8](https://avatars.discourse-cdn.com/v4/letter/x/8baadc/32.png) [@xginn8](https://forums.balena.io/u/xginn8)\
**Post date:** [July 17, 2019, 9:41pm UTC](https://forums.balena.io/t/output-supervisor-logs-journalctl-to-a-file/20807/2 "2019-07-17T21:41:46Z")

</div>

Hi @rossm and welcome to the balena forums!

There is a setting in the OS configuration to persist journal to disk, and that is outlined in the second paragraph [here](https://www.balena.io/docs/reference/OS/overview/2.x/#dev-vs-prod-images). Furthermore, there is an example showing how to enable that [here](https://www.balena.io/os/docs/raspberrypi3/getting-started/#Configure-the-Image).

I hope you find this helpful!

---

<div class="post-metadata">

**Author:** ![rossm](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@rossm](https://forums.balena.io/u/rossm)\
**Post date:** [July 17, 2019, 10:36pm UTC](https://forums.balena.io/t/output-supervisor-logs-journalctl-to-a-file/20807/4 "2019-07-17T22:36:31Z")

</div>

Hi @xginn8, thanks for the useful reply! Just a quick question, once the persistent logging in enabled which file is the journalctl logs written to?

Also, is it possible if I can configure if only resin-supervisor logs are written to this file?

---

<div class="post-metadata">

**Author:** ![xginn8](https://avatars.discourse-cdn.com/v4/letter/x/8baadc/32.png) [@xginn8](https://forums.balena.io/u/xginn8)\
**Post date:** [July 17, 2019, 10:38pm UTC](https://forums.balena.io/t/output-supervisor-logs-journalctl-to-a-file/20807/5 "2019-07-17T22:38:19Z")

</div>

The logs can be accessed via the host OS at `/var/log/journal`. Unfortunately you cannot control which logs are written, and all logs written to journal are stored.

---

<div class="post-metadata">

**Author:** ![xginn8](https://avatars.discourse-cdn.com/v4/letter/x/8baadc/32.png) [@xginn8](https://forums.balena.io/u/xginn8)\
**Post date:** [July 17, 2019, 11:06pm UTC](https://forums.balena.io/t/output-supervisor-logs-journalctl-to-a-file/20807/7 "2019-07-17T23:06:27Z")

</div>

I have opened an issue internally to track your feature request. What kinds of things do you find yourself using the supervisor logs to debug? Do note we recently released [improved diagnostics tooling](https://www.balena.io/blog/experimental-device-diagnostics-features-now-available/) to help with that.

---

<div class="post-metadata">

**Author:** ![rossm](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@rossm](https://forums.balena.io/u/rossm)\
**Post date:** [July 17, 2019, 11:42pm UTC](https://forums.balena.io/t/output-supervisor-logs-journalctl-to-a-file/20807/9 "2019-07-17T23:42:12Z")

</div>

Thanks so much!

Just to confirm, all I would have to configure is the `/boot/config.json` file to look like

```auto
{
 "persistentLogging": false,
 "hostname": "mydevice",
}

```

---

<div class="post-metadata">

**Author:** ![zvin](https://avatars.discourse-cdn.com/v4/letter/z/a5b964/32.png) [@zvin](https://forums.balena.io/u/zvin)\
**Post date:** [July 18, 2019, 7:51am UTC](https://forums.balena.io/t/output-supervisor-logs-journalctl-to-a-file/20807/10 "2019-07-18T07:51:58Z")

</div>

@rossm if you want to enable persistent logging, you need to add a `"persistentLogging": true` line in the `config.json` file on the boot partition.

---

<div class="post-metadata">

**Author:** ![rossm](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@rossm](https://forums.balena.io/u/rossm)\
**Post date:** [July 18, 2019, 4:22pm UTC](https://forums.balena.io/t/output-supervisor-logs-journalctl-to-a-file/20807/12 "2019-07-18T16:22:49Z")

</div>

Thanks @zvin! Do you know if it’s possible to change where the logs are written to instead of /var/log/journal?
