Back to all guides
Server Administration

Server Monitoring and Logs

4 read2026-04-09

Effective monitoring and log analysis are crucial for maintaining a healthy, secure, and performant server. This guide introduces the best tools and commands for keeping an eye on your Linux system.

1. Real-Time Resource Monitoring

Understanding your server's current resource usage helps you identify bottlenecks instantly.

Using bpytop

bpytop is a visually appealing, interactive process viewer that provides a real-time overview of your CPU, RAM, disk, and network usage.

bash
# Install bpytop
sudo apt install bpytop -y

# Run bpytop
bpytop

Using vmstat

vmstat reports information about processes, memory, paging, block IO, traps, and CPU activity.

bash
# View summary every 2 seconds
vmstat 2

2. Disk Space Monitoring

Running out of disk space can cause databases to crash and services to fail.

Check overall disk usage

Use the df (disk free) command to see available space on all mounted filesystems:

bash
df -h

Find large files and directories

Use the du (disk usage) command to find what is consuming space:

bash
# See the sizes of folders in the current directory
du -sh *

# Find the top 10 largest directories in /var
sudo du -ah /var | sort -rh | head -n 10

3. Understanding System Logs

Logs are your primary source of truth when troubleshooting errors or investigating security incidents. Most Linux logs are stored in the /var/log directory.

Viewing logs with journalctl

Systemd uses the journal system to manage logs. journalctl is the tool used to query these logs.

bash
# View all logs (use space to paginate, q to quit)
journalctl

# Follow the log file in real-time (like tail -f)
journalctl -f

# View logs for a specific service (e.g., SSH)
journalctl -u ssh

Essential Log Files

If you need to read logs directly, here are the most important ones:

  • /var/log/syslog or /var/log/messages: General system messages and service logs.
  • /var/log/auth.log or /var/log/secure: Authentication logs, including SSH logins and sudo usage.
  • /var/log/apt/history.log: History of apt package installations and updates.

Use tail to view the end of a log file:

bash
# View the last 50 lines of the auth log
sudo tail -n 50 /var/log/auth.log

4. Advanced Monitoring (Prometheus & Grafana)

For a visual and long-term monitoring solution, consider deploying Prometheus (to collect metrics) and Grafana (to visualize them). This setup allows you to create comprehensive dashboards alerting you before resources run out.

KVM Linux VPS

Looking for the right Linux VPS?

Put your project into practice right away: Our KVM VPS provide full root access, lightning-fast NVMe storage, and reliable KVM isolation. Flexible prepaid billing with no subscription and personal Discord support.

Full Root Access (SSH)
Datacenter NVMe SSD
4+ Tbps DDoS Protection
100% Prepaid (No Subscription)