Logging a node process in Balena


Im not sure If I just cant find the docs? I am running a node process that uses a web-socket to to send a receive messages.

Im wondering, does Balenas, built in node, automatically restart the node processes upon crash? Or should I rely on a service like PM2 or forever-js?

How would I go about viewing the logs generated by this node process?

Hello, I don’t think that it would automatically restart a node process if it happened to crash - using pm2 would be suitable. To view logs you can check balena engine logs with journalctl -f -n 1000 -a -u balena, which will give you logs for the current session. You can use it with | grep CONTAINER_ID to filter for the container running your node process. Hope this helps.

1 Like