A log is a timestamped record that an application, operating system or infrastructure component writes when something happens, such as a request, an error or a configuration change. Logging is the practice of producing, collecting and storing these records. Logs can be unstructured text or structured key-value data and are one of the core telemetry signals.
What is a log?
A log is the oldest and most universal telemetry signal. Every web server, database, operating system and application writes log entries: a line or record with a timestamp and a message describing what happened. Logging is the practice of writing these records and, in modern systems, of collecting them centrally so they can be searched and analyzed.
Logs answer the question "what exactly happened here?". A metric can tell you that the error rate of a service has risen, but the log entry tells you which exception was thrown, with which parameters and in which code path. That level of detail makes logs indispensable for debugging, security investigations and audit trails.
The flip side is volume. A single busy service can write millions of log lines per day, and most of them are never read. Good logging is therefore less about writing more and more about writing the right records with enough context, so that the few entries you need during an incident can be found within seconds.
Anatomy of a log entry
A useful log entry contains at least a timestamp, a severity and a message. In practice, further context makes the difference between a searchable record and noise:
- Timestamp with time zone, ideally in UTC and with millisecond precision.
- Severity or log level, such as DEBUG, INFO, WARN, ERROR or FATAL.
- Message or body: the human-readable description.
- Source: service, host, container, pod or file that emitted the entry.
- Attributes: user ID, order ID, HTTP status, duration and other key-value pairs.
- Trace context: trace ID and span ID to correlate the log with the request that produced it.
The OpenTelemetry log data model formalizes these fields with names such as Timestamp, SeverityNumber, SeverityText, Body, Attributes, Resource, TraceId and SpanId, so logs from different sources can be handled uniformly.
Unstructured and structured logs
Traditional logs are free text, for example an access log line from a web server:
203.0.113.7 - - [27/Oct/2026:10:15:32 +0000] "GET /cart HTTP/1.1" 500 1024
Such lines are easy for humans to read but have to be parsed with patterns before machines can filter by status code or path. Structured logging writes the same information as key-value data, usually JSON:
{"time":"2026-10-27T10:15:32Z","level":"ERROR","service":"cart","http.status":500,"msg":"cart lookup failed","trace_id":"4bf92f3577b34da6a3ce929d0e0e4736"}
Structured logs can be filtered, aggregated and turned into metrics without fragile parsing rules, which is why they are the recommended default for new applications.
Common types of logs
- Application logs: messages written by your own code and frameworks.
- Access logs: one entry per request handled by web servers, proxies and load balancers.
- System logs: operating system and kernel messages, for example via syslog or journald.
- Container and Kubernetes logs: stdout and stderr of containers plus Kubernetes events.
- Audit logs: who did what and when, required for security and compliance.
- Database logs: slow query logs, error logs and transaction logs.
From log line to insight
In distributed systems logs are spread over many hosts and containers, and containers disappear together with their local files. That is why logs are shipped to a central backend, a process called log aggregation. A typical pipeline collects logs with an agent or the OpenTelemetry Collector, parses and enriches them with metadata, filters noise, masks personal data, and finally stores and indexes them for search. A retention policy defines how long each class of logs is kept.
Processing before storage matters for cost and compliance. Dropping health-check noise, sampling verbose debug output and masking e-mail addresses or IP addresses in the pipeline is far cheaper than storing everything and cleaning up later. Logs can also be turned into metrics at ingestion, for example a count of payment errors per provider, which keeps dashboards fast even when the raw logs are retained only briefly.
Best practices
- Log in a structured format with consistent field names across services.
- Choose log levels deliberately; DEBUG logs in production can multiply volume and cost.
- Never log secrets, passwords or full payment data, and mask personal data before storage.
- Include the trace ID in every log entry to connect logs and traces.
- Log events and decisions, not every loop iteration; use metrics for high-frequency counts.
- Write to stdout in containers and let the platform handle collection.
How Obseria helps
Obseria collects logs via OpenTelemetry, the Obseria Agent or existing shippers. The Obseria Pipeline parses, filters and masks personal data before storage, and Obseria Lake stores logs without an index for fast search. Log analytics links every entry to its trace and lets you query with OQL or SQL.