Read remote application log


I have written a script that uses curl commands from the Balena Cloud API reference document to check if a given device is online, and this is working very well.

Does the Balena API support the ability to retrieve the most recent application log messages from a given device? If so, do you have any example curl commands that could retrieve the application logs from a given device? I don’t need to stream the logs - I would just like to pull down the most recent messages from a device.

Hi, the /device/v2/{uuid}/logs endpoint looks like what you need, with curl it would be something like
curl -X "GET" -H "Content-Type: application/json" -H "Authorization: Bearer {token}" "{uuid}/logs"
The output would not be plain text but a JSON object holding the log lines together with meta-data such as timestamps.

That was exactly what I needed! Thank you very much!