journalctl reads logs from systemd. Use it when a service fails, a game server will not start, SSH is behaving oddly, or you need to see recent system errors.

The most useful form is usually journalctl -u service-name, because it filters the log to one service instead of showing the whole VPS.

  1. Connect to the VPS with SSH.
  2. View recent system logs:
    sudo journalctl -n 100
  3. Follow live logs:
    sudo journalctl -f
  4. View logs for one service, replacing nginx with your service name:
    sudo journalctl -u nginx

    Linux VPS terminal showing journalctl output for the SSH service

  5. Limit logs by time:
    sudo journalctl --since "1 hour ago"
    sudo journalctl -u myserver --since "today"
  6. Print output directly instead of opening the pager:
    sudo journalctl -u myserver --no-pager -n 100

 

Common options

OptionUse
-u serviceShow logs for one service.
-fFollow new log lines live.
-n 100Show the last 100 lines.
--sinceLimit logs to a time range.
--no-pagerPrint output directly instead of opening the pager view.

When troubleshooting a failed service, start with the newest lines first. The useful error is usually near the bottom of the output, directly after the latest start attempt.

  • 0 Uživatelům pomohlo
Byla tato odpověď nápomocná?

Související články

How to connect to a Linux VPS with SSH

SSH is the normal way to manage a Linux VPS. It gives you a terminal on the server so you can...

How to update packages on a Linux VPS

Keeping packages updated helps patch security issues and keeps server tools compatible. Run...

How to create a sudo user on a Linux VPS

A sudo user lets you manage a Linux VPS without logging in as root for every task. This is safer...

How to secure SSH on a Linux VPS

SSH is the main way to manage a Linux VPS, so it should be secured before the server is used for...

How to check disk usage on a Linux VPS

Disk usage issues can stop updates, backups, logs, databases, and game saves from writing...