Add usage example repo to documentation

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2019-08-21 15:09:09 +01:00
parent 48bccd34db
commit da0534b3c8

View File

@ -1204,18 +1204,18 @@ Show journal logs from `unit` only, equivalent to
`journalctl --unit=<unit>`.
##### format
Added in supervisor version v10.3.0
The format which will be streamed from journalctl, formats
are described here:
are described here:
https://www.freedesktop.org/software/systemd/man/journalctl.html#-o
Fields should be provided via POST body in JSON format.
From an application container (with systemd installed):
From an application container:
```
$ curl -X POST -H "Content-Type: application/json" --data '{"follow":true,"all":true}' "$BALENA_SUPERVISOR_ADDRESS/v2/journal-logs?apikey=$BALENA_SUPERVISOR_API_KEY" | systemd-journal-remote - -o log.journal
$ curl -X POST -H "Content-Type: application/json" --data '{"follow":true,"all":true}' "$BALENA_SUPERVISOR_ADDRESS/v2/journal-logs?apikey=$BALENA_SUPERVISOR_API_KEY" > log.journal
```
The `log.journal` file can then be viewed with
```
journalctl --file log.journal -f
```
An example project using this endpoint can be found
[in this repository](https://github.com/balena-io-playground/device-cloud-logging).