Question

How to access the runtime logs for droplet

I need to check the runtime logs for the ubuntu droplet, I tried to use the cli with doctl apps list but it returns an empty table, and I dont know the droplet id so I can’t do doclt logs <id>.

Thank you


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.

Bobby Iliev
Site Moderator
Site Moderator badge
October 16, 2023

Hi there,

The doctl apps list command you tried before is for listing deployed apps on the DigitalOcean App Platform, which is a different service than Droplets. Hence, it didn’t show your Droplet details.

Here are the steps to access runtime logs for an Ubuntu Droplet:

  1. Find Your Droplet’s ID: First, list all your droplets to find the ID of the droplet you’re interested in.

    doctl compute droplet list
    

    This will show you a list of droplets along with their IDs, names, public IPs, etc. Locate your droplet in this list and note down its ID.

  2. SSH into Your Droplet: After identifying the Droplet ID and its associated IP, SSH into the droplet using the command:

    ssh root@YOUR_DROPLET_IP
    

    Replace YOUR_DROPLET_IP with the IP address of your droplet.

  3. Once you’re in the Droplet, it will depend on which logs you need to check but here are some general guidelines. You can check system logs using the journalctl command:

    journalctl
    

    If you’d like to view logs for a specific service, for example, nginx, you can use:

    journalctl -u nginx
    
  4. Other Useful Logs: Ubuntu stores logs in the /var/log/ directory. Some useful logs in this directory include:

    • /var/log/syslog: System log
    • /var/log/auth.log: Authentication logs
    • /var/log/apache2/: Apache web server logs (if you have Apache installed)
    • /var/log/nginx/: Nginx web server logs (if you have Nginx installed)

    To view these logs, you can use any text editor or utilities like cat, less, or tail. For instance:

    tail -f /var/log/syslog
    

    The above command will show the last few lines of the syslog and update in real-time.

  5. Exit Your Droplet: Once you’re done, simply type exit to leave the SSH session.

Hope that this helps!

Best,

Bobby

Try DigitalOcean for free

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

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel