Skip to main content
← All guides

How to read logs — finding the cause of errors

When a program shuts down or behaves strangely, the cause is almost always written in the logs. Where to look depends on how the program was started, so follow the section that matches how you run yours.

Tips for reading logs

  • Start from the bottom. The most recent entries are at the bottom.
  • Look for words like Error, Exception, Traceback, failed and denied.
  • If there are several lines of errors, the first error is often the real cause.
  • Copying the error message as it is and searching for it usually turns up a fix.

Programs run with pm2 (Node.js bots and apps)

pm2 logs my-bot               # Live logs (Ctrl + C to exit)
pm2 logs my-bot --lines 200   # Last 200 lines
pm2 logs my-bot --err         # Errors only

Programs run with systemd (Python bots, apps, etc.)

journalctl -u my-bot -f                    # Live logs
journalctl -u my-bot -n 100 --no-pager     # Last 100 lines
journalctl -u my-bot --since "1 hour ago"  # Last hour
sudo systemctl status my-bot               # Status and the last few log lines

Docker containers

docker ps -a                   # Container list (including stopped ones; check STATUS)
docker logs --tail 100 name     # Last 100 lines
docker logs -f name             # Live logs

Programs run inside screen or tmux

The program prints straight to its screen, so go back into the window to see it. (screen -r name, tmux attach -t name) A Minecraft server also writes to logs/latest.log in the server folder.

tail -n 100 ~/minecraft/logs/latest.log

Nginx (websites)

sudo tail -n 50 /var/log/nginx/error.log    # Errors (502, permission problems, etc.)
sudo tail -f /var/log/nginx/access.log      # Live access log

System-wide

journalctl -p err -b --no-pager | tail -n 50     # Errors since this boot
sudo dmesg | grep -i "out of memory"            # Programs forcibly shut down because memory ran out
journalctl --list-boots | tail -n 5             # Recent reboots

If there are out-of-memory records, see When memory runs low.

Windows server

  • For programs you started yourself, check what's printed in the console window. If the window closes too quickly to read, add pause as the last line of the .bat file.
  • System records are in Start menu → Event Viewer → Windows Logs → Application / System.

When contacting us

When you contact technical support, sending the error part of the log along with it helps us help you much faster. But if tokens or passwords appear in the log, remove them before sending.

If your problem isn't solved, open a ticket on our Discord.