Question

Get the stdout of a droplet

Is there a way to access the stdout of droplets? I started running a node.js script that was running fine on a different host, virtually as-is, but is crashing on my DO droplet. When I access the console for the droplet, it is wiped clean, and the logs that went to stdout is no longer there.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

alexdo
Site Moderator
Site Moderator badge
February 8, 2023

Hello @undetected

You can modify the script to log the output in a file if the server logs do not contain information about what went wrong.

Keep in mind that the logs might have passed rotation so you can check all the log files on the server even the compressed archives.

Regards

KFSys
Site Moderator
Site Moderator badge
February 8, 2023

Hi @undetected,

You can start the process in Screen and and follow it to see where it crashes.

Additionally, if you are using PM2 you can configure loging as well. It’s not also strange that your logs are empty. Check your /var/log folder for your application’s logs.

Check this here - https://www.digitalocean.com/community/tutorials/how-to-use-pm2-to-setup-a-node-js-production-environment-on-an-ubuntu-vps

It’s how ot use pm2 with nodejs, should be helpful.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up