Is it possible to access the main-log inside container

My dockerfile runs an entryscript that configures various system settings for the started container. The log output from the commands run in the entrypoint is captured by the host’s “main” service. I can see the that output if I go to the specific device on the https://dashboard.balena-cloud.com/devices/xxx.

Is there any ways of accessing that log info from inside the running container?

/ abaldur

If you install strace into your container, you can capture the output of your application using strace -p <PID> -e write=1,2 where <PID> is the pid of your application process. If you want to read these logs regularly it might be worth redirecting your application’s log output to a static file.

Thank you for the reply.

Whats the easiest way to get access to the application PID from inside the container?

/ abaldur

Hello @abaldur, you can get the PID of a given application with the command pidof <app name>.
Then with that information, you can run the strace.

Good luck :slight_smile: