Skip to content
An example of using the journald log streaming endpoint on balena-supervisor
Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
images
log-gatherer
log-producer
README.md
docker-compose.yml

README.md

Storing a balena device's journal logs

This project is an example of how to persist a device's journal logs to either the disk, or the loggly cloud service.

Note that this project should be used as an example only, and the methods used to post logs to loggly are inefficient. No log rotation is implemented if the project is not using the loggly backend, which means that the device file system can fill up over time.

This project requires a device running balena-supervisor version >= v10.3.0.

Usage

Create an application on the balena dashboard, with the device type you plan to use. We will assume an application name of logging-app for the rest of this usage explanation.

Push this project to an application using balena-cli:

$ balena push logging-app

Saving logs to disk

By default this project will write the journal logs to disk. The location of these logs will be /logs/log.journal in the log-gatherer container. This location is actually the mount point of the docker volume log-volume, defined in our docker-compose.yml file.

Exporting logs to the loggly service

This option requires a loggly account, and the HTTPS endpoint available from the loggly dashboard:

loggly-dashboard

Take this URL and assign it to the device environment variable LOGGLY_URL on the balena dashboard. This will cause the service to restart and the logs will instead be streamed to loggly, and not saved on disk.

You can’t perform that action at this time.