What Is a Log in OpenTelemetry?

What Is a Log in OpenTelemetry?

A log is a time-stamped record of something that happened inside a program. In OpenTelemetry, a log becomes a structured log record that carries severity, context and a link to the trace it belongs to. This guide explains it from zero, with analogies, diagrams and real-world patterns.

Imagine the logbook that a ship’s captain keeps on the bridge. Every few hours, someone writes a line in it: the time, what the weather was like, which course the ship took, and anything unusual that happened. When the ship reaches port, or when something goes wrong, investigators read the logbook to understand the story of the voyage. The notes are plain, written in order, and each one is stamped with a time. A software log is the same kind of record. A program writes a line whenever something worth remembering happens, and engineers read those lines later to understand what the program did. OpenTelemetry takes this old and familiar idea and gives it a modern, standard shape.

1Why Programs Write Logs

A running program is a black box, and logs are the little windows we cut into it.

When a program runs on a server far away, nobody can watch it work. It does not have a face, and it cannot tell you what it is thinking. Yet people need to know what it did. Did the customer’s payment succeed? Why did a file fail to load? Which user triggered an error at three in the morning? Without any record, engineers are left guessing.

So programmers add small statements to their code that write a message whenever something interesting happens. A message may say that a user signed in, that a payment of a certain amount was accepted, that a database connection failed, or that the program is starting up. Each message is a log line. Collected together, these lines form the log, which is the diary of the program.

Simple Analogy

Think of a security guard making rounds in a building at night. At each door he writes down the time and what he saw: door locked, light on, strange noise. In the morning, the manager reads the notebook and knows exactly what happened while she slept. The program is the building, the guard is the logging code, and the notebook is the log.

What
happened inside the program
When
it happened, down to the millisecond
Why
extra details that explain the cause

2A Quick Map of OpenTelemetry

A short refresher on the big picture helps logs find their place.

OpenTelemetry, often called OTel, is an open-source project that defines how software describes its own behavior. It is vendor neutral, which means no single monitoring company owns it. It handles three kinds of data, called signals. Each signal answers a different kind of question, and logs are one of the three.

Signal 1

Traces

The journey of one request across many services, split into timed steps called spans. They answer where the time went.

Signal 2

Metrics

Numbers measured over time, such as requests per second. They answer how much and how fast.

Signal 3

Logs

Time-stamped records of events, with text and details. They answer what exactly happened and why.

Support

Resource

A description of who is sending the data, such as the service name, version and host. Every signal carries it.

i
Beginner Tip

A handy way to remember the three: metrics notice a problem, traces locate it, and logs explain it. A healthy investigation often uses all three together.

3So, What Exactly Is a Log in OpenTelemetry?

It is a structured record of one event, with a defined set of fields that every tool understands.

Let us define it carefully. A log, in the language of OpenTelemetry, is a recording of an event. Each individual entry is called a log record. A log record is not just a line of free text. It is a small structured package with named parts: a time, a severity level, a message body, a set of descriptive attributes, a description of the source, and optionally the identifiers of the trace and span that were active when the event happened.

The important idea is that OpenTelemetry gives every log record the same shape, no matter which programming language, framework or library produced it. A log from a Java service, a Python script and a Go program all arrive looking alike. Tools can then search, filter and connect them without learning many private formats.

Simple Analogy

Imagine that every country used a different shape of electrical plug. Travelers would need a bag full of adapters. OpenTelemetry’s log record is a universal plug: whatever the origin, the data fits the same socket.

1

Something happens

A user signs in, a payment fails, or a program starts.

2

The program emits a log record

Using its normal logging code, it records a message and some details.

3

OpenTelemetry shapes it

The library fills in the standard fields, such as time, severity, source and trace identifiers.

4

The record is exported

It travels to a Collector or backend, where it is stored and searched.

!
Common Misconception

A log record is not the same thing as a line in a text file. A text file line is just characters. A log record is a structured object that may be written to a file, but also carries named fields that tools can use directly.

4Anatomy of a Log Record

Every log record is built from the same set of named parts.

OpenTelemetry defines a standard log data model, which is a list of the parts that a log record may have. Knowing these parts is like knowing the fields on a form. Once you know them, every log you meet becomes easy to read.

FieldWhat it holdsEveryday comparison
TimestampWhen the event actually happenedThe time written in the captain’s logbook
Observed timestampWhen the system noticed or collected the eventThe time the clerk copied the note into the archive
Severity number and textHow serious the event isA label such as routine, warning or emergency
BodyThe main message or contentThe sentence the guard wrote
AttributesExtra named details about this eventSticky notes attached to the entry
ResourceWhich service, host or container produced itThe name of the building and the guard
Instrumentation scopeWhich library or component wrote itWhich department wrote the note
Trace ID and Span IDWhich request and step were activeA tracking number printed on the parcel
Trace flagsWhether the trace is being recordedA small switch showing if the journey was sampled
Event nameAn optional name that marks the log as a named eventA title at the top of a form
flowchart TD
  L["Log Record"] --> T["Timestamp and observed timestamp"]
  L --> S["Severity number and severity text"]
  L --> B["Body: the message"]
  L --> A["Attributes: extra details"]
  L --> R["Resource: who sent it"]
  L --> I["Instrumentation scope: which library"]
  L --> C["Trace ID, Span ID and flags: which request"]
        
FIG 1 — The parts of an OpenTelemetry log record
i
Good to Know

Not every field must be filled in. A simple log may have only a time, a severity and a body. The model describes what is possible, and each producer fills in what it knows.

5Timestamps: Two Clocks, Two Questions

Time sounds simple, but logs carry two different times for good reasons.

When did the event happen, and when did the system find out about it? These can be very different. Imagine a program that writes lines into a text file. A collector reads the file a few seconds later. The event time is written inside the line, but the collector sees the line only at a later moment. OpenTelemetry keeps both.

Clock 1

Timestamp

The time the event occurred, according to the source. It is the best answer to the question of when something truly happened.

Clock 2

Observed Timestamp

The time the event was seen by the collecting system. If the source gave no time, this one is used as a fallback.

Simple Analogy

A postcard has a date written by the sender and a postmark stamped by the post office. The first tells you when the message was written, and the second tells you when the system received it. Both help if you need to understand a delay.

!
Common Mistake

Letting machines run with clocks that are wrong. If two servers disagree about the time by a few minutes, their logs will appear in the wrong order and confuse investigations. Keep machine clocks synchronized.

6Severity: How Serious Is It?

Every log record can say how important it is, using a shared scale.

Not all events deserve equal attention. A message that says the program started is routine. A message that says the database is unreachable is urgent. To tell them apart, logs carry a severity. OpenTelemetry defines a number from one to twenty-four, grouped into six familiar levels, and also allows the original text label that the source used, such as the word warning.

LevelNumber rangeTypical meaning
Trace1 to 4Extremely detailed steps, usually only for deep debugging
Debug5 to 8Developer-focused detail about what the program is doing
Info9 to 12Normal, expected events that tell the story of the program
Warn13 to 16Something unusual that may become a problem
Error17 to 20Something failed, and work could not be completed
Fatal21 to 24A very serious failure, often one that stops the program

The number ranges exist because different logging libraries have different scales, and a shared number lets tools compare them. A warning from one library and a warning from another land in the same band, so a single filter such as show me everything at warning or above works across the whole company.

Simple Analogy

Think of the colors of a traffic light plus a few more. Green is routine, yellow is caution, red is stop. Severity levels are a finer-grained version of this idea, so people can quickly find the red lights among thousands of green ones.

i
Practical Tip

In production, many teams keep only info and above to control cost, and turn debug on temporarily for one service when investigating a problem.

7Body and Attributes: Message vs Details

A good log separates the human sentence from the machine-friendly facts.

The body is the main content of the log record. Often it is a short human-readable sentence, such as a message saying a payment was declined. The body can also be structured data, for instance a set of named values, when the producer prefers that.

Attributes are the extra named details that describe the event. Instead of burying the customer’s region, the payment method and the amount inside a sentence, you attach them as separate attributes. This is what turns a log from a diary entry into searchable data.

Unstructured Log

  • One long sentence with all details mixed inside
  • Easy for a human to read casually
  • Hard for tools to search by a single detail
  • Needs fragile text matching to extract values

Structured Log

  • Short body plus named attributes for each detail
  • Tools can filter by region, status or amount directly
  • Consistent across services and languages
  • Slightly more care needed when writing
Simple Analogy

Compare a handwritten paragraph about a purchase with a printed receipt that has separate boxes for date, item, price and shop. Both describe the same purchase, but only the receipt can be sorted and totaled automatically.

!
Watch Out

Putting secrets or personal data in attributes or in the body is easy to do by accident. Attributes are indexed and searchable, which makes leaked secrets even easier to find and spread.

8The Magic Link: Logs and Traces Together

This is the feature that makes OpenTelemetry logs special.

Traditional logs have a long-standing weakness. A busy service writes thousands of lines per second for thousands of customers, all mixed together. When one customer complains, it is hard to find the lines that belong to that customer’s request. OpenTelemetry solves this by letting every log record carry the Trace ID and Span ID of the work that was happening at the moment the log was written.

With these identifiers, a log is no longer a loose line. It is attached to a specific step of a specific request. Engineers can look at a slow trace and jump to the exact logs from that step, or look at an error log and jump to the whole trace around it.

flowchart LR
  T["Trace: one request, Trace ID T1"] --> S1["Span: check login, Span ID S2"]
  T --> S2["Span: charge card, Span ID S3"]
  S2 --> L1["Log: card declined, Trace ID T1, Span ID S3"]
  S1 --> L2["Log: login ok, Trace ID T1, Span ID S2"]
        
FIG 2 — Logs carry the identifiers of the trace and span that produced them
Simple Analogy

Picture each note in the courier’s records carrying the parcel’s tracking number. Instead of searching a mountain of notes by time and guesswork, you search by the number and see every note for that one parcel.

1

Spot the failing trace

An alert shows slow or failing checkouts, and the engineer opens an example trace.

2

Copy the Trace ID

The identifier acts as a key that opens all related evidence.

3

Search logs by that ID

Every log from every service involved in that single request appears together.

4

Read the cause

The exact error message in the exact service reveals the root cause.

i
Big Win

Many teams find that this one link, logs stamped with trace identifiers, shortens investigations from hours to minutes, because guessing and manual matching disappear.

9Resource and Scope: Who Wrote This?

Two fields describe the origin of every log record.

A log without a source is a note found on the floor. OpenTelemetry therefore attaches two kinds of origin information. The resource describes the entity that produced the telemetry, such as the service name, its version, the host machine, the container and the cloud region. It is shared by everything that entity emits, so it is attached once and applies to every log, metric and trace.

The instrumentation scope describes the specific library or component that wrote the record, including its name and version. This helps when you want to separate logs written by your own code from logs written by a database driver or a web framework.

Origin 1

Resource

Answers: which service, version, host and region sent this? Think of it as the return address on the envelope.

Origin 2

Instrumentation Scope

Answers: which library inside the service wrote this? Think of it as the department stamp on the letter.

!
Common Mistake

Forgetting to set a clear service name in the resource. The backend then shows logs from an unknown service, and engineers cannot filter to the part of the system they care about.

10How Logs Get Into OpenTelemetry: The Bridge

Developers usually keep the logging tools they already know.

Almost every programming language already has a favorite logging library, and most programs already use it. Asking everyone to rewrite their logging code would be unrealistic. OpenTelemetry takes a smarter route. It provides a Logs Bridge API, which is designed not for application developers to call directly, but for people who build the connectors, usually called appenders or handlers, that plug into existing logging libraries.

The idea is simple. The developer keeps writing logs the way they always did. A small bridge sits inside the logging library, receives each record, and converts it into an OpenTelemetry log record. During this step it also fills in the trace and span identifiers from the current context, which is how the magic link of the previous chapter appears without extra effort from the developer.

flowchart LR
  A["Application code writes a log with its usual logging library"] --> B["Log appender or bridge"]
  B --> C["OpenTelemetry Logger"]
  C --> D["Log record processor"]
  D --> E["Log record exporter"]
  E --> F["Collector or backend"]
        
FIG 3 — The bridge converts ordinary logs into OpenTelemetry log records
Simple Analogy

A bridge is like a translator standing between two speakers. The programmer keeps speaking the language they know, and the translator hands the message to OpenTelemetry in its standard language, adding helpful tags along the way.

i
Design Insight

Because the bridge lives in the logging library, you can adopt OpenTelemetry for logs by adding a connector and a little configuration, rather than editing thousands of log statements across your code.

11The Building Blocks Inside the SDK

A handful of cooperating parts move a log record from birth to export.

Inside an application, the OpenTelemetry SDK has a few pieces that work together for logs. Each has a small and clear job, and keeping them separate makes the system flexible.

Part 1

Logger Provider

The manager of logging for the whole application. It is set up once and holds the settings, such as the resource and the processors.

Part 2

Logger

The handle used by a bridge or library to emit log records. Loggers are named after the component that uses them.

Part 3

Log Record Processor

Receives each finished record and decides what to do with it, for example send it right away or batch it with others.

Part 4

Log Record Exporter

The final step that packages records and sends them to a Collector or backend using a standard protocol.

Batching protects the application

Sending every log record over the network the instant it appears would be slow and wasteful. The common choice is a batch processor, which gathers records in a memory queue and sends them in groups from a background thread. The application continues without waiting. The trade-off is a small delay, and a risk that records still waiting in memory could be lost if the program crashes suddenly.

!
Watch Out

A short-lived program, such as a scheduled job, may end before its background worker sends the last batch. Make sure the program flushes and shuts down the logging pipeline before exiting, or the most interesting last logs may vanish.

12Other Ways Logs Enter the Pipeline

Not every log comes from code that uses an OpenTelemetry bridge.

Many logs are written to files or to the console by programs that know nothing about OpenTelemetry. Think of older software, third-party products, databases and operating systems. For these, the OpenTelemetry Collector, a standalone program that receives, processes and exports telemetry, can pick the logs up from the outside.

Reading log files

A file-reading component of the Collector follows text files as they grow, turns each line into a log record, and parses out fields such as time and severity.

Receiving over the network

The Collector can accept logs sent in the standard OpenTelemetry protocol, and also in other common formats and protocols from existing systems.

Container and platform streams

In container platforms, programs print to standard output, and the platform stores these streams as files. The Collector reads them and enriches each record with labels such as pod and namespace.

Cloud services

Cloud providers publish their own service logs. Receivers can subscribe to these streams and bring them into the same pipeline.

i
Good to Know

Logs collected from files lack trace identifiers unless the program itself wrote them into the line. This is one reason many teams prefer the bridge approach for new applications.

13The Collector: Cleaning and Routing Logs

Raw logs are noisy, and the Collector is where they are shaped.

Logs are the largest of the three signals by volume. A busy company can produce terabytes of logs in a day, and much of it is repetitive or of little value. The Collector works as a pipeline with receivers, processors and exporters, and for logs its processors do several valuable jobs.

1

Parse

Turn messy text lines into structured fields, so that time, severity and key details become separate attributes.

2

Enrich

Add helpful labels such as the environment, region, team or version, so that logs can be grouped and searched.

3

Filter

Drop low-value records, such as constant health-check messages, to reduce cost.

4

Mask

Hide or remove sensitive values such as card numbers and personal identifiers before data leaves the company.

5

Route

Send important logs to fast search tools, and a full copy to cheap long-term storage.

flowchart LR
  A["Receivers: files, network, platform streams"] --> B["Processors: parse, enrich, filter, mask"]
  B --> C["Exporter to fast search tool"]
  B --> D["Exporter to low-cost archive"]
  B --> E["Exporter to security tool"]
        
FIG 4 — A Collector pipeline for logs
Simple Analogy

The Collector is like a mail sorting center. Letters arrive in all shapes. Workers read the addresses, throw away junk, black out private details, and send each letter to the right destination.

14Logs vs Events

A named kind of log record is often called an event.

You may hear the word event used alongside the word log. In OpenTelemetry, an event is a log record that has a name, which identifies what kind of occurrence it is and defines the shape of its attributes. For example, a record named for a user completing a purchase would always carry the same set of attributes describing that purchase.

Plain logs are free-form. They are written for people to read and are often loosely structured. Events are more formal: the name acts like a type, so tools can count them, chart them and trust their fields. Both travel through the same log pipeline.

QuestionPlain logEvent
Has a name that identifies its kind?Usually noYes
Shape of its attributesVaries freelyDefined and consistent
Main readerA human investigatingTools and people together
Typical exampleA message about a retryA recorded user sign-in event
i
Practical Tip

If you find yourself searching logs by matching the same phrase again and again, that occurrence may deserve to be a named event with fixed attributes.

15Logs vs Traces vs Metrics

Each signal has strengths, and none replaces the others.

QuestionLogsTracesMetrics
Main strengthRich detail about one eventPath and timing of one requestCheap trends over time
Volume and costHighestMedium, often sampledLowest
Best questionWhat exactly happened and why?Where did the time go?Is something wrong right now?
Everyday pictureThe captain’s diaryThe parcel’s tracking historyThe dashboard gauges
WeaknessHard to see the big pictureNeeds context to be passed alongNo detail on individual events
1

Metrics notice

An error rate rises above normal and an alert fires.

2

Traces locate

Example failing traces reveal which service and step is responsible.

3

Logs explain

Logs linked to those traces show the exact message, context and cause.

“Metrics tell you that something is wrong, traces tell you where, and logs tell you why.”

16Security and Privacy for Logs

Logs often hold more secrets than anyone intended.

Because logs are written by developers in a hurry, they sometimes capture things that should never be stored: passwords, access tokens, card numbers, email addresses and full request bodies. Once these lines enter a searchable system and are copied to archives and vendors, they are very hard to remove. A careful approach treats the log pipeline as a place that must be protected.

Protection 1

Do Not Log Secrets

The best protection is to never write sensitive values in the first place. Review log statements with the same care as any other code.

Protection 2

Mask Early

Use Collector processors to hide or remove sensitive fields as early as possible, before data travels far.

Protection 3

Encrypt in Transit

Use secure connections between every stage so that no one can read logs from the network.

Protection 4

Control Access

Limit who can search and download logs, and keep a record of who looked at what.

Protection 5

Set Retention Rules

Delete logs when policies or laws require, and keep them in regions where they are allowed to live.

!
Privacy Warning

Once sensitive data reaches an external vendor or a long-term archive, removing it is slow and sometimes impossible. Mask before you send, not after.

17Volume, Cost and Sampling of Logs

Logs are easy to produce and expensive to keep.

Logging feels free when you write the line. The bill arrives later, because storage and search are priced by volume. A single chatty loop can produce millions of lines. Teams therefore manage log volume with a few simple habits.

1

Use levels wisely

Keep debug and trace levels off in production unless investigating, and use info for meaningful events only.

2

Filter noise in the Collector

Drop constant health-check lines and other low-value records before they reach expensive storage.

3

Tier your storage

Send important logs to fast search tools and keep a full copy in cheap cold storage.

4

Sample repetitive records

Keep every error but only a fraction of routine, repetitive messages.

5

Prefer metrics for counting

If you only need to know how many times something happened, a counter metric is far cheaper than millions of log lines.

Simple Analogy

Keeping every log forever is like keeping every receipt, ticket and note you ever received in your house. Eventually the house is full and finding anything is impossible. A sensible person keeps the important ones close at hand and boxes up the rest.

i
Cost Insight

Many teams discover that a large share of their stored logs is never read by anyone. Filtering and tiering in the pipeline is often the fastest way to cut observability bills without losing the evidence that matters.

18Design Patterns and Anti-patterns

Good habits and bad habits repeat across organizations.

Patterns that work

The strongest pattern is structured logging with context: short, clear messages, named attributes for each detail, and automatic trace identifiers. A second is log once at the right place, where the error is handled, instead of writing the same error at every layer it passes through. A third is process in the Collector, not in the application, so that masking, filtering and routing rules can change without redeploying code.

ANTI-PATTERN-01 Avoid
Problem

Writing long free-text sentences with every detail mixed inside and no named attributes.

Why It’s Harmful

Searching by a single detail needs fragile text matching, and different teams phrase the same fact differently.

Correct Approach

Keep the body short and put each detail in a named attribute with consistent names across teams.

ANTI-PATTERN-02 Avoid
Problem

Logging sensitive data such as passwords, tokens and full card numbers.

Why It’s Harmful

The data spreads into searchable storage, archives and vendors, creating legal and security risk that is very hard to undo.

Correct Approach

Never write secrets, review log statements, and mask in the Collector as a second line of defense.

ANTI-PATTERN-03 Avoid
Problem

Logs without trace and span identifiers, so they cannot be matched to the request that caused them.

Why It’s Harmful

Engineers must guess which lines belong together using time and names, which is slow and error-prone.

Correct Approach

Use the logging bridge so that the current trace and span identifiers are added automatically.

ANTI-PATTERN-04 Avoid
Problem

Logging the same error at every layer as it travels up through the code.

Why It’s Harmful

One failure produces many near-identical lines, inflating cost and hiding the real source.

Correct Approach

Log the error once, where it is finally handled, with full context.

ANTI-PATTERN-05 Avoid
Problem

Using logs to count things, such as writing one line per request just to know how many requests happened.

Why It’s Harmful

It creates huge volume and cost for an answer that a counter metric gives almost for free.

Correct Approach

Use a Counter metric for counting, and keep logs for events that need explanation.

19Best Practices and Common Mistakes

A short checklist that saves hours of pain later.

Do

Write Structured Logs

Use short messages and named attributes so tools can search and group your data.

Do

Include Trace Context

Turn on correlation so every log carries its trace and span identifiers.

Do

Choose Severity Honestly

Reserve error for real failures. If everything is an error, nothing stands out.

Do

Name Your Service

Set a clear service name and version in the resource so logs can be filtered by owner.

Do

Flush Before Exit

Shut down the logging pipeline cleanly so the final batch is not lost.

Don’t

Log Secrets

Passwords, tokens and personal data do not belong in logs.

Don’t

Log Inside Hot Loops

A line per iteration of a tight loop can bury the system in volume and slow the program.

Don’t

Ignore Clocks

Keep machine time synchronized so logs from different servers sort correctly.

i
Debugging Tip

If logs are missing, check the basics first: is the bridge or receiver configured, is a filter removing them, is the severity threshold too high, and did the program live long enough to flush its last batch?

20Advantages and Trade-offs

Every design choice has a price, and logs are no exception.

Advantages

  • Richest detail about exactly what happened and why
  • One standard shape across languages and tools
  • Direct links to traces through trace and span identifiers
  • Works with the logging libraries teams already use through bridges
  • Can be collected from files, networks and platforms with no code changes
  • Routing lets one stream serve operations, security and audit

Disadvantages / Trade-offs

  • Highest volume and cost of the three signals
  • Easy to leak secrets by accident
  • Hard to see the big picture without metrics and traces
  • Unstructured legacy logs need parsing work
  • Batching adds a small delay and a risk of loss on a crash

Balancing detail and cost

Every extra line gives more detail and costs more money. Too little logging leaves engineers blind during an incident. Too much logging buries the evidence and inflates the bill. The skill lies in logging the events that explain behavior, in a structured way, and trusting metrics and traces to carry the rest of the load.

21Real-World Examples

Seeing how teams use OpenTelemetry logs makes the ideas concrete.

An online retailer investigating a failed checkout

A customer reports that checkout failed. Support finds the Trace ID shown on the error screen, searches logs by that identifier, and sees that the pricing service rejected a coupon. The fix is made the same day.

A bank protecting customer data

The bank’s Collector masks account numbers and personal fields in the first processing step. Only cleaned logs reach an external search tool, while a protected full copy stays in internal storage for auditors.

A company cutting its logging bill

After analyzing which logs engineers actually search, the team drops constant health checks, keeps only info and above in the search tool, and sends everything to cheap storage. Costs fall sharply and investigations stay fast.

A platform team adopting OpenTelemetry

Instead of editing thousands of log statements, the team adds a logging bridge to each service. Existing logs now carry trace identifiers and the standard shape, and engineers jump between traces and logs for the first time.

A team with legacy software

An old application writes plain text files. The Collector reads the files, parses each line into time, severity and fields, adds labels such as host and environment, and forwards them alongside logs from modern services.

A security operations team

A dedicated route copies authentication events and suspicious activity from the shared log stream to a security analysis tool. The security team gets what it needs without building its own collection system.

“A good log does not just say that something happened. It says where, when, how serious, and for which request.”

22Frequently Asked Questions

Q1What is a log in OpenTelemetry in one sentence?

It is a structured, time-stamped record of an event, called a log record, carrying severity, a body, attributes, a description of its source, and optionally the identifiers of the trace and span it belongs to.

Q2How is an OpenTelemetry log different from a normal log line?

A normal line is just text. An OpenTelemetry log record has defined named fields, so tools can filter by severity, source or trace without guessing from text.

Q3Do I have to rewrite my logging code to use OpenTelemetry?

Usually no. A logging bridge or appender plugs into your existing logging library and converts records into OpenTelemetry log records automatically.

Q4What is the Logs Bridge API?

It is the part of OpenTelemetry meant for building connectors into existing logging libraries. It is intended for appender authors, not for everyday application code.

Q5What does severity mean, and how many levels are there?

Severity says how serious the event is. OpenTelemetry uses numbers from one to twenty-four, grouped into trace, debug, info, warn, error and fatal bands.

Q6Why do logs have two timestamps?

One records when the event happened and the other records when the system observed it. They can differ, for example when a collector reads a file later.

Q7How do logs connect to traces?

Each log record can carry the Trace ID and Span ID that were active when it was written, so you can jump from a trace to its logs and back.

Q8What is the difference between a log and an event?

An event is a log record that has a name identifying its kind and a defined set of attributes. Plain logs are more free-form.

Q9Can the Collector collect logs from files?

Yes. The Collector can read log files, parse lines into fields, enrich them with labels and forward them, even from software that knows nothing about OpenTelemetry.

Q10Why are logs so expensive?

They are the highest-volume signal, and storage and search are usually priced by volume. Filtering, tiering and using metrics for counting help control cost.

Q11How do I keep secrets out of my logs?

Never write them in the first place, review log statements, and use Collector processors to mask or remove sensitive fields as an extra safety net.

Q12Should I use logs or metrics to count requests?

Use a metric. A counter is far cheaper than a log line for every request. Keep logs for events that need explanation.

Q13Why did my program’s last logs disappear?

Likely the program ended before the batch processor sent its final group. Flush and shut down the logging pipeline before exiting.

23Summary and Key Takeaways

We began on the bridge of a ship, where the captain’s logbook records the story of a voyage line by line. A log in OpenTelemetry is that same diary, given a modern, standard shape. Each entry is a log record with a time, a severity, a body, attributes, a description of its source and, ideally, the identifiers of the trace and span it belongs to. Existing logging libraries feed OpenTelemetry through bridges, the Collector gathers logs from files and platforms, cleans and masks them, and routes them to the right destinations. Used together with metrics and traces, logs complete the picture: metrics notice, traces locate, and logs explain.

Key Takeaways

  • A log is a structured record of an event — each entry is a log record with defined fields, not just a line of text, so every tool can read it the same way.
  • Know the anatomy — timestamp, observed timestamp, severity, body, attributes, resource, scope, and trace and span identifiers make up the standard log data model.
  • Severity is a shared scale — numbers one to twenty-four group into trace, debug, info, warn, error and fatal, so filters work across languages and libraries.
  • Trace context is the superpower — stamping logs with Trace ID and Span ID lets engineers move between a slow trace and its exact log lines in seconds.
  • Bridges keep your existing logging — appenders convert ordinary log statements into OpenTelemetry records without rewriting application code.
  • The Collector shapes the stream — it parses, enriches, filters, masks and routes logs, which controls cost and protects privacy.
  • Use the right signal — keep secrets out of logs, use metrics for counting, and let logs explain what metrics and traces reveal.