DEV Community

Arthur
Arthur

Posted on Edited on

How to Read Linux Server Logs and Find Errors

Hello, I'm Arthur.
When a website or application stops working, the first reaction is often to restart the server. Sometimes that helps, but it can also hide the real problem.

Linux logs provide clues about what happened, when it happened, and which service was involved. Learning to read them can make troubleshooting faster and help prevent the same issue from happening again.

1. Start with the system journal

Many modern Linux distributions use systemd, which includes a tool called journalctl.

To view recent system messages, run:

sudo journalctl -n 50
Enter fullscreen mode Exit fullscreen mode

This displays the latest 50 log entries. If you want to follow new messages as they appear, use:

sudo journalctl -f
Enter fullscreen mode Exit fullscreen mode

Press Ctrl + C to stop following the log.

2. Check logs for a specific service

If a website is down, check the service that runs it rather than reading every system message.

For example, to inspect Nginx logs:

sudo journalctl -u nginx
Enter fullscreen mode Exit fullscreen mode

To view only recent entries:

sudo journalctl -u nginx -n 100
Enter fullscreen mode Exit fullscreen mode

If your server uses Apache, the service name may be apache2 or httpd, depending on the Linux distribution.

You can also check whether a service is running:

sudo systemctl status nginx
Enter fullscreen mode Exit fullscreen mode

The status output may show a recent error and help you decide what to investigate next.

3. Filter logs by time

When an issue started at a known time, narrowing the log range makes it easier to find relevant messages.

For example:

sudo journalctl --since "1 hour ago"
Enter fullscreen mode Exit fullscreen mode

Or specify a time range:

sudo journalctl --since "2026-11-28 20:00" --until "2026-11-28 21:00"
Enter fullscreen mode Exit fullscreen mode

Use the date and time when the issue actually occurred. This helps avoid unrelated messages.

4. Look for common error clues

Some log messages point toward common causes:

  • Permission denied: A user or service may not have permission to access a file or directory.
  • Address already in use: Another process may already be using the required port.
  • No space left on device: The disk or a filesystem may be full.
  • Failed to start: A service may have an invalid configuration or a missing dependency.
  • Out of memory: The system may not have enough available memory for its workload.

These messages are clues, not always the complete explanation. Check the surrounding log entries before making changes.

5. Check traditional log files

Some applications write logs directly to files under /var/log.

To list available log files:

ls -lah /var/log
Enter fullscreen mode Exit fullscreen mode

For example, Nginx commonly stores access and error logs in:

/var/log/nginx/access.log
/var/log/nginx/error.log
Enter fullscreen mode Exit fullscreen mode

You can inspect the latest error entries with:

sudo tail -n 50 /var/log/nginx/error.log
Enter fullscreen mode Exit fullscreen mode

To follow the file as new entries are added:

sudo tail -f /var/log/nginx/error.log
Enter fullscreen mode Exit fullscreen mode

Log locations can vary depending on the application and its configuration.

6. Use a safe troubleshooting routine

When investigating a server problem, follow a consistent order:

  1. Confirm what is not working and when it started.
  2. Check the status of the affected service.
  3. Review that service’s logs around the failure time.
  4. Identify the exact error before changing configuration.
  5. Make one change at a time.
  6. Test the service and review the logs again.

Avoid deleting logs just to make an error disappear. Logs can be important for understanding recurring problems and checking what happened after a change.

7. Keep log files under control

Logs can grow over time, especially on busy servers. Check disk usage if logging seems excessive:

df -h
Enter fullscreen mode Exit fullscreen mode

Many Linux services use log rotation to archive older logs and prevent files from growing indefinitely. Before changing retention settings, check how much disk space is available and whether your organization has log-retention requirements.

Final thoughts

Linux logs turn server troubleshooting from guesswork into investigation. Start with the affected service, narrow the time range, and read the surrounding messages before making changes.

For applications that need dependable hosting, it is also worth reviewing the server’s resources, monitoring setup, and recovery process. HelloServer provides VPS hosting for general server workloads, while GPU dedicated servers are designed for workloads that require dedicated GPU resources.

A few minutes spent checking the right logs can often save much more time than repeatedly restarting a service.

Top comments (0)