Docker logs - viewing all stdoout and stderr

Hi,

Is there a way to see all the stdout stderr of the services on a multi service applications? i mean, i want to log everything that is being outputted to stderr/stdout.
whats the correct way to do this?

Personally I’d create another container and install a multi-source log manager like graylog.

Graylog docs will tell you how to set up services to get the logs, then you can analyze them all from one place.

Graylog also has plenty of connectors to allow then use of other apps.

HTH

hi, what’s the use-case, do you want to ship those logs off somewhere else? otherwise balenaOS already does something like that (you can see all the logs on the dashboard), we use systemd’s journald for that, if you get a hostOS shell and run journalctl -a -fu balena.service you should see them coming in…

@robertgzr, this is what i needed, i’m not intrested (currently) sending them anywhere, i want to have them on a file so i can read them.
the command you’ve sent me is not showing everything, i want to see the history as well.

hi, the command above:

journalctl -a -fu balena.service 

Is using the following flags:

-f: This behaves like the tail command, it will follow the journal updates
-u: This filters by unit, in this case balena.service

If you want to see the whole journal you can try something like:

journalctl --no-pager -a

Also, please note that by default the journal rotates and is not persistent. You can enable persistent logging (see https://www.balena.io/docs/reference/OS/configuration/#persistentlogging), however this will increase the wear on your storage medium and may fill up your storage space.

this is super helpful.
would it be possible to store this logs in a persistent manner and save them on our SD card?

Hi,
you can enable persistent logging either via the Dashboard (for the whole fleet or per-device) or manually in the device’s config.json as described here:


Just please be aware that this will increase the wear of your SD card and will consume storage space.