Library › Servers & deployment

Free guide

Reading Logs for Beginners

Find out what your application or server is doing. A log is a record of something that happened in a system. Applications, servers, databases and services create logs to help you understand: What happened When it happened What caused a problem Think of logs as the history of your system.

4 min readFor developers and IT and support staff

Find out what your application or server is doing.

A log is a record of something that happened in a system.

Applications, servers, databases and services create logs to help you understand:

  • What happened
  • When it happened
  • Whether something went wrong
  • What caused a problem

Think of logs as the history of your system.


1. What Does a Log Look Like?

A simple log might look like:

2026-10-04 01:20:15 INFO  User 42 logged in
2026-10-04 01:21:03 WARN  Database response is slow
2026-10-04 01:21:10 ERROR Database connection failed

Look for:

TIME
LEVEL
MESSAGE

2. Log Levels

You'll commonly see:

INFO

Something normal happened.

INFO User logged in

Usually nothing to worry about.

WARN

Something unusual happened.

WARN Disk space is getting low

Pay attention, but it isn't necessarily a failure.

ERROR

Something failed.

ERROR Database connection failed

This usually needs investigation.

DEBUG

Detailed information useful when troubleshooting.

DEBUG Sending request to payment service

Usually more detailed than you need during normal operation.


3. Read the Time First

When investigating a problem, find out:

When did it happen?

Look at the timestamp.

For example:

01:20
01:21
01:21
01:22

Then compare the log with when the user reported the problem.


4. Look for ERROR

A quick first step:

grep "ERROR" application.log

You can also search for:

grep "WARN" application.log

Or:

grep -i "error" application.log

-i makes the search case-insensitive.


5. Read the Lines Around the Error

The error itself may not explain the real problem.

For example:

INFO  Starting database connection
WARN  Database response slow
ERROR Database connection failed
ERROR Unable to load customer records

The first error may be more useful than the last one.

Don't immediately jump to the final error message.


6. Follow a Log as It Happens

For a log file that is actively being written:

tail -f application.log

Now new log entries will appear as they are created.

Press:

Ctrl + C

to stop.

This is extremely useful when:

  • Restarting an application
  • Testing a feature
  • Reproducing an error
  • Watching a deployment

7. See the Last Few Lines

tail application.log

More lines:

tail -n 50 application.log

This means:

Show the last 50 lines.


8. See the Beginning of a Log

head application.log

Or:

head -n 50 application.log

9. Search for Something Specific

Use grep:

grep "login" application.log

Examples:

grep "payment" application.log
grep "database" application.log
grep "timeout" application.log
grep "failed" application.log

10. Combine Commands

You can pipe commands together.

For example:

tail -n 100 application.log | grep "ERROR"

Meaning:

Get the last 100 lines, then show only the errors.

Another useful example:

grep -i "error" application.log | tail

11. Logs May Be Somewhere Else

Common places on Linux include:

/var/log/

You might see:

/var/log/syslog
/var/log/auth.log

Applications may also have their own directories:

/var/log/myapp/

Or logs may be managed by the system rather than stored in a normal file.


12. journalctl

Many Linux services use systemd.

To see service logs:

journalctl -u myapp

Follow them live:

journalctl -u myapp -f

See recent logs:

journalctl -u myapp --since "1 hour ago"

13. The Most Important Question

When something breaks, don't just search for:

ERROR

Ask:

What happened?

ERROR Database connection failed

When?

01:21:10

What happened immediately before it?

WARN Database response is slow

What happened immediately after?

ERROR Unable to load customer records

Now you're starting to trace the problem.


14. Common Things to Search For

When troubleshooting, try:

error
failed
exception
timeout
denied
refused
connection
database
authentication
permission

Don't assume the word ERROR will always be present.


15. A Simple Troubleshooting Workflow

When someone says:

"The application isn't working."

Try:

1. Reproduce the problem
        ↓
2. Note the time
        ↓
3. Open the logs
        ↓
4. Look around that time
        ↓
5. Find ERROR / WARN
        ↓
6. Read the surrounding lines
        ↓
7. Identify the first failure
        ↓
8. Investigate that failure

16. Don't Panic at Every Error

A log can contain errors that aren't the actual cause of the problem.

For example:

ERROR Request failed

might simply be a consequence of:

ERROR Database unavailable

The database error may be the real problem.

Look for the first meaningful failure.


Essential Commands

What you wantCommand
Show logcat application.log
Last linestail application.log
Last 50 linestail -n 50 application.log
Follow livetail -f application.log
First lineshead application.log
Searchgrep "text" application.log
Search ignoring casegrep -i "error" application.log
Service logsjournalctl -u service
Follow service logsjournalctl -u service -f

The Golden Rule

Don't just look at the error. Look at the story around the error.

When reading logs, think:

WHEN?
  ↓
WHAT HAPPENED?
  ↓
WHAT HAPPENED BEFORE IT?
  ↓
WHAT FAILED FIRST?
  ↓
WHY?

You don't need to understand every line in a log.

Find the time, find the problem, follow the trail.