# Install promtail in balena host

**URL:** <https://forums.balena.io/t/install-promtail-in-balena-host/350476>\
**Category:** Product support\
**Created:** [December 8, 2021, 10:12am UTC](https://forums.balena.io/t/install-promtail-in-balena-host/350476 "2021-12-08T10:12:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yaguat](https://avatars.discourse-cdn.com/v4/letter/y/7ba0ec/32.png) [@yaguat](https://forums.balena.io/u/yaguat)\
**Post date:** [December 8, 2021, 10:12am UTC](https://forums.balena.io/t/install-promtail-in-balena-host/350476/1 "2021-12-08T10:12:34Z")

</div>

I have the following project installed in a raspberry pi 4: [How to create a Minecraft Server for the Raspberry Pi 4 with balena](https://www.balena.io/blog/how-to-create-a-minecraft-server-for-the-pi-4-with-balena/)

I would like to be able to get the logs from the 4 containers installed in my raspberry pi and send them to grafana loki, for that I was trying to install promtail in the balena host but I cannot as the balena host doesn’t have most of the command required (and libraries) to install promtail.

I also though of installing promtail inside the raspberry pi host (not the balena host) but I cannot access to the logs from there.

Do you know how could I install promtail or even any other client to be able to send the logs to grafana loki ([Clients | Grafana Labs](https://grafana.com/docs/loki/latest/clients/))?

---

<div class="post-metadata">

**Author:** ![fisehara](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/fisehara/32/6290_2.png) [@fisehara](https://forums.balena.io/u/fisehara)\
**Post date:** [December 21, 2021, 10:22pm UTC](https://forums.balena.io/t/install-promtail-in-balena-host/350476/4 "2021-12-21T22:22:09Z")

</div>

Hi there,

for getting already some context. Why would you like to have the logs in a custom log backend like loki?

For the moment, the approach to install or add a service to the balenaOS is not working. It’s intended to not extend the balenaOS in this way. The way to go will be to add a parallel service that scrapes the logs from the containers and can send them to a log backend.

I’m going to comprehend these inputs and maybe you can already have a look at them, too:

> <https://github.com/grafana/loki/issues/333>
>
> I have promtail set up to scrape Docker container logs and can view them in loki…/grafana. 
> 
> I'm wondering if there's a solution to displaying them with meaningful names, like the names giving to the container? My promtail config looks like:
> 
> \`\`\`
> \- job\_name: docker
> entry\_parser: raw
> static\_configs:
> - targets:
> - localhost
> labels:
> job: dockerlogs
> \_\_path\_\_: /var/lib/docker/containers/\*/\*log
> \`\`\`
> 
> So currently if I go to Explore in Grafana and select Loki, I can choose the entire dockerlogs job or individual files - the JSON logs are obviously their file name which doesn't mean much to people without host access or looking through each. 
> 
> I'm not using Kubernetes. Do I need to create some kind of custom label which will survive a container being redeployed? 
> 
> If this is a stupid question I'm happy to be pointed to some code or doc that will help me. 
> 
> Really liking this already though. 
> 
> !\[capture\](https://user-images.githubusercontent.com/42643041/52862657-a56a3080-312d-11e9-8f12-928994dcaca7.PNG)

> <https://gist.github.com/ruanbekker/c6fa9bc6882e6f324b4319c5e3622460>

Another way could be to utilise the approach of using fluentd service integration.

> **[Fluentd](https://grafana.com/docs/loki/latest/clients/fluentd/)**
>
> Fluentd Loki Output Plugin Grafana Loki has a Fluentd output plugin called fluent-plugin-grafana-loki that enables shipping logs to a private Loki instance …

Best Regards  
Harald

---

<div class="post-metadata">

**Author:** ![yaguat](https://avatars.discourse-cdn.com/v4/letter/y/7ba0ec/32.png) [@yaguat](https://forums.balena.io/u/yaguat)\
**Post date:** [December 23, 2021, 10:45pm UTC](https://forums.balena.io/t/install-promtail-in-balena-host/350476/6 "2021-12-23T22:45:10Z")

</div>

I just wanted to have all the logs from the different services/projects I have in my home and have them with centralized logging and monitoring.

At the end what I did was create a service which connects to balena and reads all the logs send to balena and with promtail get the logs from that service and send it to loki.

---

<div class="post-metadata">

**Author:** ![rahul-thakoor](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@rahul-thakoor](https://forums.balena.io/u/rahul-thakoor)\
**Post date:** [March 23, 2022, 10:49am UTC](https://forums.balena.io/t/install-promtail-in-balena-host/350476/7 "2022-03-23T10:49:18Z")

</div>

Hey glad you managed to make it work.

For posterity, for anyone who want to collect logs, they can use [this](https://www.balena.io/docs/reference/supervisor/supervisor-api/#journald-logs) supervisor endpoint and then send to other services or store locally depending on their use case
