Operating Systems and Servers

Reading Logs to Find Out What Went Wrong

Learn how system and application logs record events, what a typical entry contains, and how to read them step by step to trace a problem to its cause.

On this page
  1. Logs are a written record
  2. What logs exist
  3. Anatomy of an entry
  4. A method for reading logs
  5. Common patterns
  6. Practical cautions
  7. Logs at scale
  8. Making the most of them

Logs are a written record

When something goes wrong on a computer, the visible symptom is often vague: an application closes, a service will not start, a sign-in fails. Meanwhile, the operating system and many applications have been quietly writing down what they did. These records are logs. Each entry describes an event, usually with the time it happened, which component reported it and a message.

Logs do not fix anything by themselves. Their value is as evidence. They can show what happened just before a failure, which is often more informative than the failure itself.

What logs exist

Different parts of a system keep different logs. Common categories include:

  • System logs. Events from the operating system and its components: startup and shutdown, hardware and driver messages, services starting or failing.
  • Security logs. Sign-in attempts, permission changes and similar actions. These matter for audits and for spotting suspicious activity.
  • Application logs. Messages written by individual programs, such as a web server recording requests and errors, or a database recording failed queries.
  • Network and device logs. Records kept by equipment such as firewalls and routers.

Where they are stored depends on the system. Some use a central viewer with filters, and others write plain text files in a known folder. The command line is useful for the latter, since you can search and filter text quickly.

Anatomy of an entry

Although formats vary, most entries contain the same ingredients.

  • Timestamp. When the event happened, often including the time zone. Check it, since logs from different machines may use different zones.
  • Source. The program, service or component that wrote the entry.
  • Severity or level. Typical levels range from informational messages through warnings to errors and critical failures. A warning means something unexpected happened that did not stop work; an error means an operation failed.
  • Message. The description, sometimes with an error code or identifier.

An error code is usually the most searchable part. Searching the exact text of a message, along with the name of the software, often leads to documentation or others who hit the same issue. Be careful to remove private details, such as names, internal addresses or passwords, before posting anything publicly.

A method for reading logs

Logs can contain thousands of lines. A structured approach stops you drowning.

  1. Pin down when it happened. Get the time of the failure as accurately as you can, even if only to within a few minutes. Ask the user, or check when a ticket was opened.
  2. Open the right log. Pick the one most likely to be involved: system logs for a boot or driver problem, an application’s log for an application problem.
  3. Go to that time and read backward. Start at the failure and look at what came just before it. The cause often appears in the preceding minutes.
  4. Filter by level. Look at errors and warnings first, then widen to informational messages for context.
  5. Find the first problem, not the loudest. One fault frequently triggers a cascade of later errors. The earliest error in the chain is usually closer to the root cause.
  6. Look for repetition. The same message every few seconds or at every startup points to a persistent fault rather than a one-off.
  7. Cross-check other sources. If a service failed, check the logs of what it depends on, such as the network or storage.

This fits into a wider troubleshooting method: form a hypothesis, test it, change one thing at a time and record the result.

Common patterns

Some situations show up often.

  • A service that starts and then stops repeatedly, usually accompanied by an error naming a missing file, a bad setting or an unavailable dependency.
  • Disk-related errors around the time of freezes, which can indicate a failing drive or a full volume.
  • Repeated failed sign-ins from an unexpected source, which might be a forgotten saved password or something more worrying, such as one of the signs of compromised accounts.
  • Out-of-memory messages when the system ran out of RAM and had to close something.

Treat these as clues, not conclusions. A message can describe a symptom caused by something else entirely.

Practical cautions

  • Logs may contain sensitive information, such as usernames, addresses or even data accidentally captured in errors. Limit who can read them and think before sharing them.
  • Logs rotate. To save space, old entries are removed or archived after some time. If you need evidence from a past incident, collect it promptly.
  • Clocks matter. If machines disagree about the time, correlating their logs becomes difficult.
  • Not everything is logged. Absence of an entry does not prove nothing happened, since logging may be set to a low level or switched off.
  • Do not delete logs to tidy up during an investigation. They may be needed later.

Logs at scale

On one computer you can read logs by hand. In an organization with many servers, teams usually gather them in one place so they can be searched together and tied to alerts, which is part of system monitoring. During a security event, logs also form part of the evidence used in incident response, so they are often retained according to policy for a defined period.

Making the most of them

Reading logs is a skill that improves with practice. A useful habit is to look at a healthy system’s logs occasionally, so you know what normal looks like. When a problem appears later, the unusual lines stand out more easily. Writing down what you found and what fixed the issue, ideally in a shared knowledge base, saves the next person from repeating the work.

The complete guide to operating systems and servers

Operating Systems Explained for Beginners
Read the guide

Keep exploring

Guides from other topics

All topics →